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 21:52:47 -0500
committerGitHub <noreply@github.com>2020-03-07 21:52:47 -0500
commita0d8caffb4f83e0e7219318fa08839ee93e653b8 (patch)
tree3c242c084c10793d1396d7caf7d8e7bce2c07f29 /ext/bg/js/settings/anki-templates.js
parentd022d61b1a66614e1837585afcb53a25253b643a (diff)
parent426c1534e7d740fa2c30488a64ad4fa6a382deed (diff)
Merge pull request #400 from toasted-nutbread/template-render-refactor
Template render refactor
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..b1665048 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, apiTemplateRender
+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({renderTemplate: apiTemplateRender});
+ result = await ankiNoteBuilder.formatField(field, definition, mode, options, templates, exceptions);
}
} catch (e) {
exceptions.push(e);