aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-12-01 21:08:46 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-12-01 21:08:46 -0500
commit3e1b080cd3f0846f623f6bcf186581ac27998256 (patch)
tree444e0b391afa15912134f36de6ef688d94dce2ff /ext/bg/js
parent767a480a847b641768b94b835a6ac10c1c3d69bf (diff)
Simplify how anki templates are reset
Diffstat (limited to 'ext/bg/js')
-rw-r--r--ext/bg/js/settings/anki-templates.js20
1 files changed, 6 insertions, 14 deletions
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() {