Fix an issue with reordering dictionary settings (#1812)

This commit is contained in:
toasted-nutbread 2021-07-09 16:06:12 -04:00 committed by GitHub
parent 24ec22b2e1
commit daa44a8389
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 0 deletions

View File

@ -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', '');

View File

@ -325,6 +325,8 @@ class DictionaryController {
value: dictionaries
}]);
this._settingsController.trigger('dictionarySettingsReordered', {source: this});
await this._updateEntries();
}

View File

@ -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});
}
}