diff --git a/ext/js/pages/settings/collapsible-dictionary-controller.js b/ext/js/pages/settings/collapsible-dictionary-controller.js index 6eb3a9b4..6a22e454 100644 --- a/ext/js/pages/settings/collapsible-dictionary-controller.js +++ b/ext/js/pages/settings/collapsible-dictionary-controller.js @@ -33,6 +33,7 @@ class CollapsibleDictionaryController { yomichan.on('databaseUpdated', this._onDatabaseUpdated.bind(this)); this._settingsController.on('optionsChanged', this._onOptionsChanged.bind(this)); + this._settingsController.on('dictionarySettingsReordered', this._onDictionarySettingsReordered.bind(this)); } // Private @@ -88,6 +89,11 @@ class CollapsibleDictionaryController { this._setDefinitionsCollapsibleAll(value); } + async _onDictionarySettingsReordered() { + const options = await this._settingsController.getOptions(); + this._onOptionsChanged({options}); + } + _setupAllSelect(fragment, options) { const select = this._addSelect(fragment, 'All', ''); diff --git a/ext/js/pages/settings/dictionary-controller.js b/ext/js/pages/settings/dictionary-controller.js index adb3edbd..47b256d8 100644 --- a/ext/js/pages/settings/dictionary-controller.js +++ b/ext/js/pages/settings/dictionary-controller.js @@ -325,6 +325,8 @@ class DictionaryController { value: dictionaries }]); + this._settingsController.trigger('dictionarySettingsReordered', {source: this}); + await this._updateEntries(); } diff --git a/ext/js/pages/settings/secondary-search-dictionary-controller.js b/ext/js/pages/settings/secondary-search-dictionary-controller.js index 8ffd9a9b..fb64adf5 100644 --- a/ext/js/pages/settings/secondary-search-dictionary-controller.js +++ b/ext/js/pages/settings/secondary-search-dictionary-controller.js @@ -31,6 +31,7 @@ class SecondarySearchDictionaryController { yomichan.on('databaseUpdated', this._onDatabaseUpdated.bind(this)); this._settingsController.on('optionsChanged', this._onOptionsChanged.bind(this)); + this._settingsController.on('dictionarySettingsReordered', this._onDictionarySettingsReordered.bind(this)); } // Private @@ -84,4 +85,9 @@ class SecondarySearchDictionaryController { const {detail: {value}} = e; node.dataset.enabled = `${value}`; } + + async _onDictionarySettingsReordered() { + const options = await this._settingsController.getOptions(); + this._onOptionsChanged({options}); + } } \ No newline at end of file