diff --git a/ts/editor/editor-toolbar/ClozeButton.svelte b/ts/editor/editor-toolbar/ClozeButton.svelte index eb6fa8579..2041b60d2 100644 --- a/ts/editor/editor-toolbar/ClozeButton.svelte +++ b/ts/editor/editor-toolbar/ClozeButton.svelte @@ -8,6 +8,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import IconButton from "../../components/IconButton.svelte"; import Shortcut from "../../components/Shortcut.svelte"; import * as tr from "../../lib/ftl"; + import { isApplePlatform } from "../../lib/platform"; import { getPlatformString } from "../../lib/shortcuts"; import { wrapInternal } from "../../lib/wrap"; import { context as noteEditorContext } from "../NoteEditor.svelte"; @@ -17,6 +18,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html const { focusedInput, fields } = noteEditorContext.get(); + // Workaround for Cmd+Option+Shift+C not working on macOS. The keyup approach works + // on Linux as well, but fails on Windows. + const event = isApplePlatform() ? "keyup" : "keydown"; + const clozePattern = /\{\{c(\d+)::/gu; function getCurrentHighestCloze(increment: boolean): number { let highest = 0; @@ -65,6 +70,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html onCloze(event.detail.originalEvent)} />