Fix typed text not being saved if saving immediately

https://forums.ankiweb.net/t/anki-2-1-55-beta-5/24870/43
This commit is contained in:
Damien Elmes 2022-12-03 22:41:17 +10:00
parent 41b329aa05
commit 7761f609a0

View file

@ -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<void> {
if (document.activeElement instanceof HTMLElement) {
document.activeElement.blur();
}
await tick();
}
async function removeConfig(): Promise<void> {
@ -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<void> {
await commitEditing();
state.save(applyToChildDecks);
}