diff --git a/ftl/core/editing.ftl b/ftl/core/editing.ftl index 131fe1034..7605a7891 100644 --- a/ftl/core/editing.ftl +++ b/ftl/core/editing.ftl @@ -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. ### deprecated, do not use + editing-bold-text-ctrlandb = Bold text (Ctrl+B) editing-italic-text-ctrlandi = Italic text (Ctrl+I) editing-underline-text-ctrlandu = Underline text (Ctrl+U) diff --git a/ts/lib/shortcuts.ts b/ts/lib/shortcuts.ts index 4d3ab87f6..9426fc169 100644 --- a/ts/lib/shortcuts.ts +++ b/ts/lib/shortcuts.ts @@ -53,7 +53,7 @@ function keyToPlatformString(key: string): string { : key; } -function toPlatformString(modifiersAndKey: string[]) { +function toPlatformString(modifiersAndKey: string[]): string { return `${modifiersToPlatformString( modifiersAndKey.slice(0, -1) )}${keyToPlatformString(modifiersAndKey[modifiersAndKey.length - 1])}`; @@ -93,21 +93,21 @@ function innerShortcut( callback: (event: KeyboardEvent) => void, ...keyCombination: string[][] ): void { + let interval: number; + if (keyCombination.length === 0) { callback(lastEvent); } else { const [nextKey, ...restKeys] = keyCombination; - let ivl: number; - const handler = (event: KeyboardEvent): void => { if (check(event, nextKey)) { innerShortcut(event, callback, ...restKeys); - clearTimeout(ivl); + clearTimeout(interval); } }; - ivl = setTimeout( + interval = setTimeout( (): void => document.removeEventListener("keydown", handler), shortcutTimeoutMs );