merged mode: remove options.dictionary.main
This commit is contained in:
parent
7783aa4c1a
commit
4e57fa1ad1
@ -154,10 +154,6 @@ function optionsSetDefaults(options) {
|
||||
|
||||
dictionaries: {},
|
||||
|
||||
dictionary: {
|
||||
main: ''
|
||||
},
|
||||
|
||||
anki: {
|
||||
enable: false,
|
||||
server: 'http://127.0.0.1:8765',
|
||||
|
@ -61,9 +61,6 @@ async function formRead() {
|
||||
const priority = parseInt(dictionary.find('.dict-priority').val(), 10);
|
||||
const enabled = dictionary.find('.dict-enabled').prop('checked');
|
||||
const main = dictionary.find('.dict-main').prop('checked');
|
||||
if (main) {
|
||||
optionsNew.dictionary.main = title;
|
||||
}
|
||||
optionsNew.dictionaries[title] = {priority, enabled, main};
|
||||
});
|
||||
|
||||
@ -302,7 +299,6 @@ async function onDictionaryPurge(e) {
|
||||
await utilDatabasePurge();
|
||||
const options = await optionsLoad();
|
||||
options.dictionaries = {};
|
||||
options.dictionary.main = '';
|
||||
await optionsSave(options);
|
||||
|
||||
await dictionaryGroupsPopulate(options);
|
||||
|
@ -50,10 +50,11 @@ class Translator {
|
||||
|
||||
async findTermsMerged(text, dictionaries, alphanumeric) {
|
||||
const options = await apiOptionsGet();
|
||||
const mainDictionary = Object.keys(options.dictionaries).filter(dict => options.dictionaries[dict].main).concat([''])[0];
|
||||
const titles = Object.keys(dictionaries);
|
||||
const {length, definitions} = await this.findTerms(text, dictionaries, alphanumeric);
|
||||
|
||||
const definitionsBySequence = dictTermsMergeBySequence(definitions, options.dictionary.main);
|
||||
const definitionsBySequence = dictTermsMergeBySequence(definitions, mainDictionary);
|
||||
|
||||
const definitionsMerged = [];
|
||||
const mergedByTermIndices = new Set();
|
||||
@ -64,7 +65,7 @@ class Translator {
|
||||
|
||||
const result = definitionsBySequence[sequence];
|
||||
|
||||
const rawDefinitionsBySequence = await this.database.findTermsBySequence(Number(sequence), options.dictionary.main);
|
||||
const rawDefinitionsBySequence = await this.database.findTermsBySequence(Number(sequence), mainDictionary);
|
||||
const definitionsByGloss = dictTermsMergeByGloss(result, rawDefinitionsBySequence);
|
||||
dictTermsMergeByGloss(result, definitionsBySequence['-1'], definitionsByGloss, mergedByTermIndices);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user