diff --git a/ts/deckoptions/DeckOptionsPage.svelte b/ts/deckoptions/DeckOptionsPage.svelte index 32eacae6d..520335f69 100644 --- a/ts/deckoptions/DeckOptionsPage.svelte +++ b/ts/deckoptions/DeckOptionsPage.svelte @@ -6,8 +6,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import ConfigSelector from "./ConfigSelector.svelte"; import ConfigEditor from "./ConfigEditor.svelte"; import type { DeckOptionsState } from "./lib"; - import { onMount, onDestroy } from "svelte"; - import { registerShortcut } from "lib/shortcuts"; import type { Writable } from "svelte/store"; import HtmlAddon from "./HtmlAddon.svelte"; import type { DynamicSvelteComponent } from "sveltelib/dynamicComponent"; @@ -33,12 +31,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html }, ]; } - - let registerCleanup: () => void; - onMount(() => { - registerCleanup = registerShortcut(() => state.save(false), "Control+Enter"); - }); - onDestroy(() => registerCleanup?.()); diff --git a/ts/deckoptions/SaveButton.svelte b/ts/deckoptions/SaveButton.svelte index 6125286e7..945043dbc 100644 --- a/ts/deckoptions/SaveButton.svelte +++ b/ts/deckoptions/SaveButton.svelte @@ -15,11 +15,18 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import DropdownItem from "components/DropdownItem.svelte"; import DropdownDivider from "components/DropdownDivider.svelte"; import WithDropdownMenu from "components/WithDropdownMenu.svelte"; + import WithShortcut from "components/WithShortcut.svelte"; const dispatch = createEventDispatcher(); export let state: DeckOptionsState; + function commitEditing(): void { + if (document.activeElement instanceof HTMLElement) { + document.activeElement.blur(); + } + } + function removeConfig(): void { // show pop-up after dropdown has gone away setTimeout(() => { @@ -27,8 +34,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html alert(tr.schedulingTheDefaultConfigurationCantBeRemoved()); return; } - // fixme: move tr.qt_misc schema mod msg into core - // fixme: include name of deck in msg const msg = (state.removalWilLForceFullSync() ? tr.deckConfigWillRequireFullSync() + " " @@ -45,15 +50,21 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } function save(applyToChildDecks: boolean): void { + commitEditing(); state.save(applyToChildDecks); } - save(false)} - >{tr.deckConfigSaveButton()} + + save(false)} + tooltip={shortcutLabel} + on:mount={createShortcut}>{tr.deckConfigSaveButton()} +