Simplify how anki templates are reset
This commit is contained in:
parent
767a480a84
commit
3e1b080cd3
@ -22,22 +22,14 @@ function onAnkiFieldTemplatesReset(e) {
|
|||||||
$('#field-template-reset-modal').modal('show');
|
$('#field-template-reset-modal').modal('show');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onAnkiFieldTemplatesResetConfirm(e) {
|
function onAnkiFieldTemplatesResetConfirm(e) {
|
||||||
try {
|
e.preventDefault();
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
$('#field-template-reset-modal').modal('hide');
|
$('#field-template-reset-modal').modal('hide');
|
||||||
|
|
||||||
const optionsContext = getOptionsContext();
|
const element = document.querySelector('#field-templates');
|
||||||
const options = await apiOptionsGet(optionsContext);
|
element.value = profileOptionsGetDefaultFieldTemplates();
|
||||||
const fieldTemplates = profileOptionsGetDefaultFieldTemplates();
|
element.dispatchEvent(new Event('change'));
|
||||||
options.anki.fieldTemplates = fieldTemplates;
|
|
||||||
$('#field-templates').val(fieldTemplates);
|
|
||||||
onAnkiTemplatesValidateCompile();
|
|
||||||
await settingsSaveOptions();
|
|
||||||
} catch (error) {
|
|
||||||
ankiErrorShow(error);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function ankiTemplatesInitialize() {
|
function ankiTemplatesInitialize() {
|
||||||
|
Loading…
Reference in New Issue
Block a user