diff options
author | Kuuuube <61125188+Kuuuube@users.noreply.github.com> | 2024-05-21 12:58:31 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-21 16:58:31 +0000 |
commit | 8548573115f627dbcfa5a5967659e82c363ef011 (patch) | |
tree | 62899b6a8f99519a3a37a66bd88d4ec4a5300566 /ext/js | |
parent | ba9fa339a43a5f494785877018b10f111ccafff5 (diff) |
Update anki settings on Configure Anki card format click (#972)
Diffstat (limited to 'ext/js')
-rw-r--r-- | ext/js/pages/settings/anki-controller.js | 13 |
1 files changed, 2 insertions, 11 deletions
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); |