mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
parent
39c3a8e104
commit
f0dc6e103f
1 changed files with 6 additions and 1 deletions
|
@ -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 IconButton from "../../components/IconButton.svelte";
|
||||||
import Shortcut from "../../components/Shortcut.svelte";
|
import Shortcut from "../../components/Shortcut.svelte";
|
||||||
import * as tr from "../../lib/ftl";
|
import * as tr from "../../lib/ftl";
|
||||||
|
import { isApplePlatform } from "../../lib/platform";
|
||||||
import { getPlatformString } from "../../lib/shortcuts";
|
import { getPlatformString } from "../../lib/shortcuts";
|
||||||
import { wrapInternal } from "../../lib/wrap";
|
import { wrapInternal } from "../../lib/wrap";
|
||||||
import { context as noteEditorContext } from "../NoteEditor.svelte";
|
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();
|
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;
|
const clozePattern = /\{\{c(\d+)::/gu;
|
||||||
function getCurrentHighestCloze(increment: boolean): number {
|
function getCurrentHighestCloze(increment: boolean): number {
|
||||||
let highest = 0;
|
let highest = 0;
|
||||||
|
@ -65,6 +70,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
<Shortcut
|
<Shortcut
|
||||||
{keyCombination}
|
{keyCombination}
|
||||||
event="keyup"
|
{event}
|
||||||
on:action={(event) => onCloze(event.detail.originalEvent)}
|
on:action={(event) => onCloze(event.detail.originalEvent)}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in a new issue