mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
use new registerShortcut() fuction in DeckConfigPage
This commit is contained in:
parent
42c466223e
commit
79b62682ab
1 changed files with 6 additions and 10 deletions
|
@ -6,18 +6,14 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
import ConfigSelector from "./ConfigSelector.svelte";
|
import ConfigSelector from "./ConfigSelector.svelte";
|
||||||
import ConfigEditor from "./ConfigEditor.svelte";
|
import ConfigEditor from "./ConfigEditor.svelte";
|
||||||
import type { DeckConfigState } from "./lib";
|
import type { DeckConfigState } from "./lib";
|
||||||
import { primaryModifierForPlatform } from "sveltelib/shortcuts";
|
import { onMount, onDestroy } from "svelte";
|
||||||
|
import { registerShortcut } from "lib/shortcuts";
|
||||||
|
|
||||||
export let state: DeckConfigState;
|
export let state: DeckConfigState;
|
||||||
|
|
||||||
function onKeyDown(evt: KeyboardEvent): void {
|
onMount(() => {
|
||||||
if (
|
onDestroy(registerShortcut(() => state.save(false), "Control+Enter"));
|
||||||
evt.code === "Enter" &&
|
});
|
||||||
evt.getModifierState(primaryModifierForPlatform())
|
|
||||||
) {
|
|
||||||
state.save(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
@ -27,7 +23,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div on:keydown={onKeyDown}>
|
<div>
|
||||||
<div id="modal">
|
<div id="modal">
|
||||||
<!-- filled in later-->
|
<!-- filled in later-->
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue