From 3e1b080cd3f0846f623f6bcf186581ac27998256 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 1 Dec 2019 21:08:46 -0500 Subject: Simplify how anki templates are reset --- ext/bg/js/settings/anki-templates.js | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'ext') diff --git a/ext/bg/js/settings/anki-templates.js b/ext/bg/js/settings/anki-templates.js index 6ba20040..9cdfc134 100644 --- a/ext/bg/js/settings/anki-templates.js +++ b/ext/bg/js/settings/anki-templates.js @@ -22,22 +22,14 @@ function onAnkiFieldTemplatesReset(e) { $('#field-template-reset-modal').modal('show'); } -async function onAnkiFieldTemplatesResetConfirm(e) { - try { - e.preventDefault(); +function onAnkiFieldTemplatesResetConfirm(e) { + e.preventDefault(); - $('#field-template-reset-modal').modal('hide'); + $('#field-template-reset-modal').modal('hide'); - const optionsContext = getOptionsContext(); - const options = await apiOptionsGet(optionsContext); - const fieldTemplates = profileOptionsGetDefaultFieldTemplates(); - options.anki.fieldTemplates = fieldTemplates; - $('#field-templates').val(fieldTemplates); - onAnkiTemplatesValidateCompile(); - await settingsSaveOptions(); - } catch (error) { - ankiErrorShow(error); - } + const element = document.querySelector('#field-templates'); + element.value = profileOptionsGetDefaultFieldTemplates(); + element.dispatchEvent(new Event('change')); } function ankiTemplatesInitialize() { -- cgit v1.2.3