aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/settings/anki-templates.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-03-07 15:14:05 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-03-07 21:46:59 -0500
commit69cce49b0d5d9f11f4ffb529ae3d060536297c07 (patch)
treee18f00ee2dd56855826a2dc70bb4cc3d682b1d37 /ext/bg/js/settings/anki-templates.js
parentd022d61b1a66614e1837585afcb53a25253b643a (diff)
Move Anki note generation functionality into a new class
Diffstat (limited to 'ext/bg/js/settings/anki-templates.js')
-rw-r--r--ext/bg/js/settings/anki-templates.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/bg/js/settings/anki-templates.js b/ext/bg/js/settings/anki-templates.js
index 244ec42e..32a990f9 100644
--- a/ext/bg/js/settings/anki-templates.js
+++ b/ext/bg/js/settings/anki-templates.js
@@ -17,8 +17,9 @@
*/
/*global getOptionsContext, getOptionsMutable, settingsSaveOptions
-ankiGetFieldMarkers, ankiGetFieldMarkersHtml, dictFieldFormat
-apiOptionsGet, apiTermsFind, apiGetDefaultAnkiFieldTemplates*/
+ankiGetFieldMarkers, ankiGetFieldMarkersHtml
+apiOptionsGet, apiTermsFind, apiGetDefaultAnkiFieldTemplates,
+AnkiNoteBuilder*/
function onAnkiFieldTemplatesReset(e) {
e.preventDefault();
@@ -92,7 +93,8 @@ async function ankiTemplatesValidate(infoNode, field, mode, showSuccessResult, i
const options = await apiOptionsGet(optionsContext);
let templates = options.anki.fieldTemplates;
if (typeof templates !== 'string') { templates = await apiGetDefaultAnkiFieldTemplates(); }
- result = await dictFieldFormat(field, definition, mode, options, templates, exceptions);
+ const ankiNoteBuilder = new AnkiNoteBuilder();
+ result = await ankiNoteBuilder.formatField(field, definition, mode, options, templates, exceptions);
}
} catch (e) {
exceptions.push(e);