From 20dd6112724a77fee16281930e79a2e6822acff7 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Tue, 19 Dec 2023 01:15:15 -0500 Subject: Remove TemplateRendererProxy mock (#388) --- ext/js/data/anki-note-builder.js | 10 +++++----- ext/js/display/display-anki.js | 3 ++- ext/js/pages/settings/anki-templates-controller.js | 3 ++- 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'ext/js') diff --git a/ext/js/data/anki-note-builder.js b/ext/js/data/anki-note-builder.js index 9240c1d8..cdb06564 100644 --- a/ext/js/data/anki-note-builder.js +++ b/ext/js/data/anki-note-builder.js @@ -18,22 +18,22 @@ import {deferPromise} from '../core.js'; import {ExtensionError} from '../core/extension-error.js'; -import {TemplateRendererProxy} from '../templates/template-renderer-proxy.js'; import {yomitan} from '../yomitan.js'; import {AnkiUtil} from './anki-util.js'; export class AnkiNoteBuilder { /** * Initiate an instance of AnkiNoteBuilder. - * @param {{japaneseUtil: import('../language/sandbox/japanese-util.js').JapaneseUtil}} details + * @param {import('../language/sandbox/japanese-util.js').JapaneseUtil} japaneseUtil + * @param {import('../templates/template-renderer-proxy.js').TemplateRendererProxy|import('../templates/sandbox/template-renderer.js').TemplateRenderer} templateRenderer */ - constructor({japaneseUtil}) { + constructor(japaneseUtil, templateRenderer) { /** @type {import('../language/sandbox/japanese-util.js').JapaneseUtil} */ this._japaneseUtil = japaneseUtil; /** @type {RegExp} */ this._markerPattern = AnkiUtil.cloneFieldMarkerPattern(true); - /** @type {TemplateRendererProxy} */ - this._templateRenderer = new TemplateRendererProxy(); + /** @type {import('../templates/template-renderer-proxy.js').TemplateRendererProxy|import('../templates/sandbox/template-renderer.js').TemplateRenderer} */ + this._templateRenderer = templateRenderer; /** @type {import('anki-note-builder').BatchedRequestGroup[]} */ this._batchedRequests = []; /** @type {boolean} */ diff --git a/ext/js/display/display-anki.js b/ext/js/display/display-anki.js index 322237da..423cdfdc 100644 --- a/ext/js/display/display-anki.js +++ b/ext/js/display/display-anki.js @@ -21,6 +21,7 @@ import {AnkiNoteBuilder} from '../data/anki-note-builder.js'; import {AnkiUtil} from '../data/anki-util.js'; import {PopupMenu} from '../dom/popup-menu.js'; import {querySelectorNotNull} from '../dom/query-selector.js'; +import {TemplateRendererProxy} from '../templates/template-renderer-proxy.js'; import {yomitan} from '../yomitan.js'; export class DisplayAnki { @@ -39,7 +40,7 @@ export class DisplayAnki { /** @type {?string} */ this._ankiFieldTemplatesDefault = null; /** @type {AnkiNoteBuilder} */ - this._ankiNoteBuilder = new AnkiNoteBuilder({japaneseUtil}); + this._ankiNoteBuilder = new AnkiNoteBuilder(japaneseUtil, new TemplateRendererProxy()); /** @type {?import('./display-notification.js').DisplayNotification} */ this._errorNotification = null; /** @type {?EventListenerCollection} */ diff --git a/ext/js/pages/settings/anki-templates-controller.js b/ext/js/pages/settings/anki-templates-controller.js index 03fda9ca..ac0cc9c2 100644 --- a/ext/js/pages/settings/anki-templates-controller.js +++ b/ext/js/pages/settings/anki-templates-controller.js @@ -20,6 +20,7 @@ import {ExtensionError} from '../../core/extension-error.js'; import {AnkiNoteBuilder} from '../../data/anki-note-builder.js'; import {querySelectorNotNull} from '../../dom/query-selector.js'; import {JapaneseUtil} from '../../language/sandbox/japanese-util.js'; +import {TemplateRendererProxy} from '../../templates/template-renderer-proxy.js'; import {yomitan} from '../../yomitan.js'; export class AnkiTemplatesController { @@ -54,7 +55,7 @@ export class AnkiTemplatesController { /** @type {?import('./modal.js').Modal} */ this._fieldTemplateResetModal = null; /** @type {AnkiNoteBuilder} */ - this._ankiNoteBuilder = new AnkiNoteBuilder({japaneseUtil: new JapaneseUtil(null)}); + this._ankiNoteBuilder = new AnkiNoteBuilder(new JapaneseUtil(null), new TemplateRendererProxy()); } /** */ -- cgit v1.2.3