From 8179846e381eb0a87bf3bc266abec8f4400565bc Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Fri, 2 Apr 2021 12:42:06 -0400 Subject: Refactor template rendering (#1583) * Update _errorToJson to _serializeError * Remove async * Refactor render * Simplify _getModifiedData * Rename data => commonData * Rename templates => template for consistency * Improve errors check * Update tests --- ext/js/pages/settings/anki-templates-controller.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ext/js/pages/settings') diff --git a/ext/js/pages/settings/anki-templates-controller.js b/ext/js/pages/settings/anki-templates-controller.js index 710946be..90e88f57 100644 --- a/ext/js/pages/settings/anki-templates-controller.js +++ b/ext/js/pages/settings/anki-templates-controller.js @@ -176,14 +176,14 @@ class AnkiTemplatesController { sentence: {text: definition.rawSource, offset: 0}, documentTitle: document.title }; - let templates = options.anki.fieldTemplates; - if (typeof templates !== 'string') { templates = this._defaultFieldTemplates; } + let template = options.anki.fieldTemplates; + if (typeof template !== 'string') { template = this._defaultFieldTemplates; } const {general: {resultOutputMode, glossaryLayoutMode, compactTags}} = options; const note = await this._ankiNoteBuilder.createNote({ definition, mode, context, - templates, + template, deckName: '', modelName: '', fields: [ -- cgit v1.2.3