From 8548573115f627dbcfa5a5967659e82c363ef011 Mon Sep 17 00:00:00 2001 From: Kuuuube <61125188+Kuuuube@users.noreply.github.com> Date: Tue, 21 May 2024 12:58:31 -0400 Subject: Update anki settings on Configure Anki card format click (#972) --- ext/js/pages/settings/anki-controller.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'ext/js/pages') diff --git a/ext/js/pages/settings/anki-controller.js b/ext/js/pages/settings/anki-controller.js index de8b2c39..1be41490 100644 --- a/ext/js/pages/settings/anki-controller.js +++ b/ext/js/pages/settings/anki-controller.js @@ -123,6 +123,8 @@ export class AnkiController { for (const node of nodes) { node.addEventListener('settingChanged', onAnkiSettingChanged); } + const ankiCardFormatSettingsEntry = querySelectorNotNull(document, '[data-modal-action="show,anki-cards"]'); + ankiCardFormatSettingsEntry.addEventListener('click', onAnkiSettingChanged); } /** @@ -606,17 +608,6 @@ class AnkiCardController { this._ankiCardFieldsContainer = this._node.querySelector('.anki-card-fields'); - /** @type {HTMLTextAreaElement} */ - const mainSettingsEntry = querySelectorNotNull(document, '[data-modal-action="show,anki-cards"]'); - mainSettingsEntry.addEventListener('click', (() => { - const updatedCardOptions = this._getCardOptions(ankiOptions, this._optionsType); - if (updatedCardOptions === null) { return; } - this._deckController.prepare(deckControllerSelect, updatedCardOptions.deck); - this._modelController.prepare(modelControllerSelect, updatedCardOptions.model); - this._fields = updatedCardOptions.fields; - void this.updateAnkiState(); - }).bind(this), false); - this._setupFields(); this._eventListeners.addEventListener(this._deckController.select, 'change', this._onCardDeckChange.bind(this), false); -- cgit v1.2.3