From 04ba7e556950dd0a18c280f4be74c1f1f07c66e5 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 3 Dec 2022 22:41:17 +1000 Subject: [PATCH] Fix typed text not being saved if saving immediately https://forums.ankiweb.net/t/anki-2-1-55-beta-5/24870/43 --- ts/deck-options/SaveButton.svelte | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ts/deck-options/SaveButton.svelte b/ts/deck-options/SaveButton.svelte index 5c7339532..7535cf046 100644 --- a/ts/deck-options/SaveButton.svelte +++ b/ts/deck-options/SaveButton.svelte @@ -24,10 +24,12 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html export let state: DeckOptionsState; - function commitEditing(): void { + /// Ensure blur handler has fired so changes get committed. + async function commitEditing(): Promise { if (document.activeElement instanceof HTMLElement) { document.activeElement.blur(); } + await tick(); } async function removeConfig(): Promise { @@ -55,8 +57,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } } - function save(applyToChildDecks: boolean): void { - commitEditing(); + async function save(applyToChildDecks: boolean): Promise { + await commitEditing(); state.save(applyToChildDecks); }