Skip to content

Commit

Permalink
Update anki settings on Configure Anki card format click (#972)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuuuube committed May 21, 2024
1 parent ba9fa33 commit 8548573
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions ext/js/pages/settings/anki-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 8548573

Please sign in to comment.