Fix settings resetting not initializing dictionary settings properly (#1036)
This commit is contained in:
parent
2e3169f68c
commit
d66a5e3b87
@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* global
|
/* global
|
||||||
|
* DictionaryController
|
||||||
* Modal
|
* Modal
|
||||||
* OptionsUtil
|
* OptionsUtil
|
||||||
* api
|
* api
|
||||||
@ -383,6 +384,14 @@ class BackupController {
|
|||||||
// Get default options
|
// Get default options
|
||||||
const optionsFull = this._optionsUtil.getDefault();
|
const optionsFull = this._optionsUtil.getDefault();
|
||||||
|
|
||||||
|
// Update dictionaries
|
||||||
|
const dictionaries = await this._settingsController.getDictionaryInfo();
|
||||||
|
for (const {options: {dictionaries: optionsDictionaries}} of optionsFull.profiles) {
|
||||||
|
for (const {title} of dictionaries) {
|
||||||
|
optionsDictionaries[title] = DictionaryController.createDefaultDictionarySettings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Assign options
|
// Assign options
|
||||||
try {
|
try {
|
||||||
await this._settingsImportSetOptionsFull(optionsFull);
|
await this._settingsImportSetOptionsFull(optionsFull);
|
||||||
|
@ -489,11 +489,7 @@ class DictionaryController {
|
|||||||
targets.push({
|
targets.push({
|
||||||
action: 'set',
|
action: 'set',
|
||||||
path,
|
path,
|
||||||
value: {
|
value: DictionaryController.createDefaultDictionarySettings()
|
||||||
enabled: false,
|
|
||||||
allowSecondarySearches: false,
|
|
||||||
priority: 0
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -502,4 +498,12 @@ class DictionaryController {
|
|||||||
await this._settingsController.modifyGlobalSettings(targets);
|
await this._settingsController.modifyGlobalSettings(targets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static createDefaultDictionarySettings() {
|
||||||
|
return {
|
||||||
|
enabled: false,
|
||||||
|
allowSecondarySearches: false,
|
||||||
|
priority: 0
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user