mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 22:42:25 -04:00
Add shortcuts for list and indentation (#1546)
This commit is contained in:
parent
65f6728454
commit
e336f5a239
1 changed files with 37 additions and 15 deletions
|
@ -13,7 +13,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import * as tr from "../lib/ftl";
|
import * as tr from "../lib/ftl";
|
||||||
import { getListItem } from "../lib/dom";
|
import { getListItem } from "../lib/dom";
|
||||||
import { execCommand } from "./helpers";
|
import { appendInParentheses, execCommand } from "./helpers";
|
||||||
import {
|
import {
|
||||||
ulIcon,
|
ulIcon,
|
||||||
olIcon,
|
olIcon,
|
||||||
|
@ -26,6 +26,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
outdentIcon,
|
outdentIcon,
|
||||||
} from "./icons";
|
} from "./icons";
|
||||||
import { getNoteEditor } from "./OldEditorAdapter.svelte";
|
import { getNoteEditor } from "./OldEditorAdapter.svelte";
|
||||||
|
import WithShortcut from "../components/WithShortcut.svelte";
|
||||||
|
import { withButton } from "../components/helpers";
|
||||||
|
|
||||||
export let api = {};
|
export let api = {};
|
||||||
|
|
||||||
|
@ -54,7 +56,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<CommandIconButton
|
<CommandIconButton
|
||||||
key="insertUnorderedList"
|
key="insertUnorderedList"
|
||||||
tooltip={tr.editingUnorderedList()}
|
tooltip={tr.editingUnorderedList()}
|
||||||
withoutShortcut>{@html ulIcon}</CommandIconButton
|
shortcut={"Control+,"}>{@html ulIcon}</CommandIconButton
|
||||||
>
|
>
|
||||||
</ButtonGroupItem>
|
</ButtonGroupItem>
|
||||||
|
|
||||||
|
@ -62,7 +64,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<CommandIconButton
|
<CommandIconButton
|
||||||
key="insertOrderedList"
|
key="insertOrderedList"
|
||||||
tooltip={tr.editingOrderedList()}
|
tooltip={tr.editingOrderedList()}
|
||||||
withoutShortcut>{@html olIcon}</CommandIconButton
|
shortcut={"Control+."}>{@html olIcon}</CommandIconButton
|
||||||
>
|
>
|
||||||
</ButtonGroupItem>
|
</ButtonGroupItem>
|
||||||
|
|
||||||
|
@ -119,23 +121,43 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<Item id="indentation">
|
<Item id="indentation">
|
||||||
<ButtonGroup>
|
<ButtonGroup>
|
||||||
<ButtonGroupItem>
|
<ButtonGroupItem>
|
||||||
<IconButton
|
<WithShortcut
|
||||||
on:click={outdentListItem}
|
shortcut={"Control+Shift+,"}
|
||||||
tooltip={tr.editingOutdent()}
|
let:createShortcut
|
||||||
{disabled}
|
let:shortcutLabel
|
||||||
>
|
>
|
||||||
{@html outdentIcon}
|
<IconButton
|
||||||
</IconButton>
|
on:click={outdentListItem}
|
||||||
|
on:mount={withButton(createShortcut)}
|
||||||
|
tooltip={appendInParentheses(
|
||||||
|
tr.editingOutdent(),
|
||||||
|
shortcutLabel,
|
||||||
|
)}
|
||||||
|
{disabled}
|
||||||
|
>
|
||||||
|
{@html outdentIcon}
|
||||||
|
</IconButton>
|
||||||
|
</WithShortcut>
|
||||||
</ButtonGroupItem>
|
</ButtonGroupItem>
|
||||||
|
|
||||||
<ButtonGroupItem>
|
<ButtonGroupItem>
|
||||||
<IconButton
|
<WithShortcut
|
||||||
on:click={indentListItem}
|
shortcut={"Control+Shift+."}
|
||||||
tooltip={tr.editingIndent()}
|
let:createShortcut
|
||||||
{disabled}
|
let:shortcutLabel
|
||||||
>
|
>
|
||||||
{@html indentIcon}
|
<IconButton
|
||||||
</IconButton>
|
on:click={indentListItem}
|
||||||
|
on:mount={withButton(createShortcut)}
|
||||||
|
tooltip={appendInParentheses(
|
||||||
|
tr.editingIndent(),
|
||||||
|
shortcutLabel,
|
||||||
|
)}
|
||||||
|
{disabled}
|
||||||
|
>
|
||||||
|
{@html indentIcon}
|
||||||
|
</IconButton>
|
||||||
|
</WithShortcut>
|
||||||
</ButtonGroupItem>
|
</ButtonGroupItem>
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
</Item>
|
</Item>
|
||||||
|
|
Loading…
Reference in a new issue