mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Satisfy formatter
This commit is contained in:
parent
f6ef4d43cb
commit
57357a42a5
2 changed files with 6 additions and 5 deletions
|
@ -43,6 +43,7 @@ editing-unordered-list = Unordered list
|
||||||
editing-warning-cloze-deletions-will-not-work = Warning, cloze deletions will not work until you switch the type at the top to Cloze.
|
editing-warning-cloze-deletions-will-not-work = Warning, cloze deletions will not work until you switch the type at the top to Cloze.
|
||||||
|
|
||||||
### deprecated, do not use
|
### deprecated, do not use
|
||||||
|
|
||||||
editing-bold-text-ctrlandb = Bold text (Ctrl+B)
|
editing-bold-text-ctrlandb = Bold text (Ctrl+B)
|
||||||
editing-italic-text-ctrlandi = Italic text (Ctrl+I)
|
editing-italic-text-ctrlandi = Italic text (Ctrl+I)
|
||||||
editing-underline-text-ctrlandu = Underline text (Ctrl+U)
|
editing-underline-text-ctrlandu = Underline text (Ctrl+U)
|
||||||
|
|
|
@ -53,7 +53,7 @@ function keyToPlatformString(key: string): string {
|
||||||
: key;
|
: key;
|
||||||
}
|
}
|
||||||
|
|
||||||
function toPlatformString(modifiersAndKey: string[]) {
|
function toPlatformString(modifiersAndKey: string[]): string {
|
||||||
return `${modifiersToPlatformString(
|
return `${modifiersToPlatformString(
|
||||||
modifiersAndKey.slice(0, -1)
|
modifiersAndKey.slice(0, -1)
|
||||||
)}${keyToPlatformString(modifiersAndKey[modifiersAndKey.length - 1])}`;
|
)}${keyToPlatformString(modifiersAndKey[modifiersAndKey.length - 1])}`;
|
||||||
|
@ -93,21 +93,21 @@ function innerShortcut(
|
||||||
callback: (event: KeyboardEvent) => void,
|
callback: (event: KeyboardEvent) => void,
|
||||||
...keyCombination: string[][]
|
...keyCombination: string[][]
|
||||||
): void {
|
): void {
|
||||||
|
let interval: number;
|
||||||
|
|
||||||
if (keyCombination.length === 0) {
|
if (keyCombination.length === 0) {
|
||||||
callback(lastEvent);
|
callback(lastEvent);
|
||||||
} else {
|
} else {
|
||||||
const [nextKey, ...restKeys] = keyCombination;
|
const [nextKey, ...restKeys] = keyCombination;
|
||||||
|
|
||||||
let ivl: number;
|
|
||||||
|
|
||||||
const handler = (event: KeyboardEvent): void => {
|
const handler = (event: KeyboardEvent): void => {
|
||||||
if (check(event, nextKey)) {
|
if (check(event, nextKey)) {
|
||||||
innerShortcut(event, callback, ...restKeys);
|
innerShortcut(event, callback, ...restKeys);
|
||||||
clearTimeout(ivl);
|
clearTimeout(interval);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ivl = setTimeout(
|
interval = setTimeout(
|
||||||
(): void => document.removeEventListener("keydown", handler),
|
(): void => document.removeEventListener("keydown", handler),
|
||||||
shortcutTimeoutMs
|
shortcutTimeoutMs
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue