aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/settings
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-09-09 11:54:40 -0400
committerGitHub <noreply@github.com>2020-09-09 11:54:40 -0400
commit2aa86cc5f8cda022076f7fa047f17fdcca4a0f5e (patch)
treed89d3776d46e76fc818b3ac4ba420d38c024002e /ext/bg/js/settings
parentb687870a55eae43a71ea3adc41be0ab341a8721f (diff)
Anki API refactor (#790)
* Add function guiBrowseNote * Assign default server as null * Use get/set properties for server/enabled * Refactor option values * Refactor createNote/Data functions to not use options format directly * Use createNote for testing * Add errors
Diffstat (limited to 'ext/bg/js/settings')
-rw-r--r--ext/bg/js/settings/anki-templates.js18
1 files changed, 16 insertions, 2 deletions
diff --git a/ext/bg/js/settings/anki-templates.js b/ext/bg/js/settings/anki-templates.js
index fb03ef14..87f13100 100644
--- a/ext/bg/js/settings/anki-templates.js
+++ b/ext/bg/js/settings/anki-templates.js
@@ -147,8 +147,22 @@ class AnkiTemplatesController {
renderTemplate: api.templateRender.bind(api),
getClipboardImage: api.clipboardGetImage.bind(api)
});
- const data = ankiNoteBuilder.createNoteData(definition, mode, context, options);
- result = await ankiNoteBuilder.formatField(field, data, templates, exceptions);
+ const {general: {resultOutputMode, compactGlossaries}} = options;
+ const note = await ankiNoteBuilder.createNote({
+ definition,
+ mode,
+ context,
+ templates,
+ resultOutputMode,
+ compactGlossaries,
+ modeOptions: {
+ fields: {field},
+ deck: '',
+ model: ''
+ },
+ errors: exceptions
+ });
+ result = note.fields.field;
}
} catch (e) {
exceptions.push(e);