aboutsummaryrefslogtreecommitdiff
path: root/ext/js/pages/settings/dictionary-import-controller.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-04-03 13:02:49 -0400
committerGitHub <noreply@github.com>2021-04-03 13:02:49 -0400
commita9fe2d03b22a0dd5760019f1325a7a86ebb07b85 (patch)
treeaa2fe04c741c82c0456f44a39139c52988b6c22d /ext/js/pages/settings/dictionary-import-controller.js
parent0d2d342cd373798e3daf42799a9f35d974db92f5 (diff)
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
Diffstat (limited to 'ext/js/pages/settings/dictionary-import-controller.js')
-rw-r--r--ext/js/pages/settings/dictionary-import-controller.js15
1 files changed, 7 insertions, 8 deletions
diff --git a/ext/js/pages/settings/dictionary-import-controller.js b/ext/js/pages/settings/dictionary-import-controller.js
index afa45899..c7b72110 100644
--- a/ext/js/pages/settings/dictionary-import-controller.js
+++ b/ext/js/pages/settings/dictionary-import-controller.js
@@ -19,7 +19,6 @@
* DictionaryController
* DictionaryDatabase
* DictionaryImporter
- * ObjectPropertyAccessor
*/
class DictionaryImportController {
@@ -213,12 +212,12 @@ class DictionaryImportController {
const profileCount = optionsFull.profiles.length;
for (let i = 0; i < profileCount; ++i) {
const {options} = optionsFull.profiles[i];
- const value = DictionaryController.createDefaultDictionarySettings(true);
- const path1 = ObjectPropertyAccessor.getPathString(['profiles', i, 'options', 'dictionaries', title]);
- targets.push({action: 'set', path: path1, value});
+ const value = DictionaryController.createDefaultDictionarySettings(title, true);
+ const path1 = `profiles[${i}].options.dictionaries`;
+ targets.push({action: 'push', path: path1, items: [value]});
if (sequenced && options.general.mainDictionary === '') {
- const path2 = ObjectPropertyAccessor.getPathString(['profiles', i, 'options', 'general', 'mainDictionary']);
+ const path2 = `profiles[${i}].options.general.mainDictionary`;
targets.push({action: 'set', path: path2, value: title});
}
}
@@ -230,9 +229,9 @@ class DictionaryImportController {
const targets = [];
const profileCount = optionsFull.profiles.length;
for (let i = 0; i < profileCount; ++i) {
- const path1 = ObjectPropertyAccessor.getPathString(['profiles', i, 'options', 'dictionaries']);
- targets.push({action: 'set', path: path1, value: {}});
- const path2 = ObjectPropertyAccessor.getPathString(['profiles', i, 'options', 'general', 'mainDictionary']);
+ const path1 = `profiles[${i}].options.dictionaries`;
+ targets.push({action: 'set', path: path1, value: []});
+ const path2 = `profiles[${i}].options.general.mainDictionary`;
targets.push({action: 'set', path: path2, value: ''});
}
return await this._modifyGlobalSettings(targets);