Index: gc_lang/fr/webext/panel/lex_editor.js ================================================================== --- gc_lang/fr/webext/panel/lex_editor.js +++ gc_lang/fr/webext/panel/lex_editor.js @@ -535,19 +535,19 @@ if (oResult.hasOwnProperty("shared_dictionaries")) { this.oDictionaries = oResult.shared_dictionaries; } if (oResult.hasOwnProperty("personal_dictionary")) { this.oPersonalDictionary = oResult.personal_dictionary; - oBinaryDict.load("__personal__"); } if (oResult.hasOwnProperty("created_dictionaries_list")) { this.lCreatedDictionaries = oResult.created_dictionaries_list; for (let sDicName of this.lCreatedDictionaries) { let xOption = createNode("option", {value: sDicName, textContent: sDicName}); this.xDicSelector.appendChild(xOption); } } + oBinaryDict.load("__personal__"); }, addDictionary: function (sDicName) { if (!this.oDictionaries.hasOwnProperty(sDicName)) { let xOption = createNode("option", {value: sDicName, textContent: sDicName}); @@ -586,10 +586,14 @@ } return null; }, saveDictionary: function (sName, oJSON) { + if (!sName) { + console.log("Error: name of dictionary to save is empty.") + return; + } if (sName == "__personal__") { browser.runtime.sendMessage({ sCommand: "setDictionary", dParam: {sDictionary: "personal", oDict: oJSON}, dInfo: {} }); browser.storage.local.set({ "personal_dictionary": oJSON }); } else { @@ -655,11 +659,11 @@ oIBDAWG: null, sName: "", sDescription: "", - load: function (sName) { + load: function (sName="__personal__") { console.log("lexicon editor, load: " + sName); this.sName = sName; let oJSON = oDictHandler.getDictionary(sName); if (oJSON) { this.parseDict(oJSON); @@ -736,11 +740,11 @@ listen: function () { document.getElementById("dic_selector").addEventListener("change", () => {this.load(document.getElementById("dic_selector").value)}, false); document.getElementById("save_button").addEventListener("click", () => { this.build(); }, false); document.getElementById("export_button").addEventListener("click", () => { this.export(); }, false); document.getElementById("import_input").addEventListener("change", () => { this.import(); }, false); - document.getElementById("new_dictionary_button").addEventListener("click", () => { switchDisplay("new_dictionary_section"); }, false); + //document.getElementById("new_dictionary_button").addEventListener("click", () => { switchDisplay("new_dictionary_section"); }, false); document.getElementById("delete_dictionary_button").addEventListener("click", () => { this.delete(); }, false); document.getElementById("create_dictionary_button").addEventListener("click", () => { this.newDictionary(); }, false); }, build: function () {