From a9fe2d03b22a0dd5760019f1325a7a86ebb07b85 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 3 Apr 2021 13:02:49 -0400 Subject: Update dictionary settings structure (#1587) * Update dictionary settings structure to use an array instead of an object * Update ensureDictionarySettings implementation * Remove some usage of ObjectPropertyAccessor --- ext/js/data/options-util.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'ext/js/data') diff --git a/ext/js/data/options-util.js b/ext/js/data/options-util.js index ca122e89..857ef630 100644 --- a/ext/js/data/options-util.js +++ b/ext/js/data/options-util.js @@ -459,7 +459,8 @@ class OptionsUtil { {async: false, update: this._updateVersion7.bind(this)}, {async: true, update: this._updateVersion8.bind(this)}, {async: false, update: this._updateVersion9.bind(this)}, - {async: true, update: this._updateVersion10.bind(this)} + {async: true, update: this._updateVersion10.bind(this)}, + {async: true, update: this._updateVersion11.bind(this)} ]; } @@ -786,4 +787,17 @@ class OptionsUtil { } return options; } + + _updateVersion11(options) { + // Version 11 changes: + // Changed dictionaries to an array. + for (const profile of options.profiles) { + const dictionariesNew = []; + for (const [name, {priority, enabled, allowSecondarySearches, definitionsCollapsible}] of Object.entries(profile.options.dictionaries)) { + dictionariesNew.push({name, priority, enabled, allowSecondarySearches, definitionsCollapsible}); + } + profile.options.dictionaries = dictionariesNew; + } + return options; + } } -- cgit v1.2.3