diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-01-10 19:28:50 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-10 19:28:50 -0500 |
commit | 4ed949364564f00a8b871095d030af516fc2ed6d (patch) | |
tree | 8a7ac38887874f67f2e99187f7ab3ce29496fe51 /ext/mixed/js/display.js | |
parent | 25080ac82eef83fdaa921e2a8b12261130b8ac85 (diff) |
Refactor anki note building (#1223)
* Move TemplateRendererProxy creation into AnkiNoteBuilder
* Simplify _stringReplaceAsync
* Organize note generation
* Rename API
* Make the template rendering function more generic
Diffstat (limited to 'ext/mixed/js/display.js')
-rw-r--r-- | ext/mixed/js/display.js | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index b43b4dca..3cb4b0e4 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -27,7 +27,6 @@ * MediaLoader * PopupFactory * QueryParser - * TemplateRendererProxy * TextScanner * WindowScroll * api @@ -89,10 +88,7 @@ class Display extends EventDispatcher { this._mode = null; this._defaultAnkiFieldTemplates = null; this._defaultAnkiFieldTemplatesPromise = null; - this._templateRenderer = new TemplateRendererProxy(); - this._ankiNoteBuilder = new AnkiNoteBuilder({ - renderTemplate: this._renderTemplate.bind(this) - }); + this._ankiNoteBuilder = new AnkiNoteBuilder(true); this._updateAdderButtonsPromise = Promise.resolve(); this._contentScrollElement = document.querySelector('#content-scroll'); this._contentScrollBodyElement = document.querySelector('#content-body'); @@ -1493,10 +1489,6 @@ class Display extends EventDispatcher { return value; } - async _renderTemplate(template, data, marker) { - return await this._templateRenderer.render(template, data, marker); - } - async _addDefinition(definition, mode, context) { const options = this._options; const templates = await this._getTemplates(options); |