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 @@ -199,10 +199,13 @@ if (document.getElementById(this.sNodeId + "_row_" + iEntry)) { document.getElementById(this.sNodeId + "_row_" + iEntry).style.display = "none"; } this.nEntry -= 1; this.showEntryNumber(); + if (this.sNodeId == "lexicon_table") { + showElement("save_button"); + } } getEntries () { return this.lEntry.filter((e) => e !== null); } @@ -531,30 +534,35 @@ lEntry.push(aRes); } oLexiconTable.fill(lEntry); this.setDictData(this.oIBDAWG.nEntry, this.oIBDAWG.sDate); }, + + save: function (oJSON) { + browser.storage.local.set({ "oPersonalDictionary": oJSON }); + browser.runtime.sendMessage({ sCommand: "setDictionary", dParam: {sDictionary: "personal", oDict: oJSON}, dInfo: {} }); + }, import: function () { let xInput = document.getElementById("import_input"); let xFile = xInput.files[0]; let xURL = URL.createObjectURL(xFile); let sJSON = helpers.loadFile(xURL); if (sJSON) { try { let oJSON = JSON.parse(sJSON); - browser.storage.local.set({ "oPersonalDictionary": oJSON }); this.__load(oJSON); + this.save(oJSON); } catch (e) { console.error(e); this.setDictData(0, "#Erreur. Voir la console."); return; } } else { this.setDictData(0, "[néant]"); - browser.storage.local.set({ "oPersonalDictionary": "" }); + this.save(null); } }, setDictData: function (nEntries, sDate) { document.getElementById("dic_num_entries").textContent = nEntries; @@ -576,19 +584,18 @@ let xProgressNode = document.getElementById("wait_progress"); let lEntry = oLexiconTable.getEntries(); if (lEntry.length > 0) { let oDAWG = new DAWG(lEntry, "S", "fr", "Français", "Dictionnaire personnel", xProgressNode); let oJSON = oDAWG.createBinaryJSON(1); - browser.storage.local.set({ "oPersonalDictionary": oJSON }); + this.save(oJSON); this.oIBDAWG = new IBDAWG(oJSON); this.setDictData(this.oIBDAWG.nEntry, this.oIBDAWG.sDate); - browser.runtime.sendMessage({ sCommand: "setDictionary", dParam: {sDictionary: "personal", oDict: oJSON}, dInfo: {} }); } else { this.setDictData(0, "[néant]"); - browser.storage.local.set({ "oPersonalDictionary": "" }); - browser.runtime.sendMessage({ sCommand: "setDictionary", dParam: {sDictionary: "personal", oDict: null}, dInfo: {} }); + this.save(null); } + hideElement("save_button"); }, export: function () { let xBlob = new Blob([ JSON.stringify(this.oIBDAWG.getJSON()) ], {type: 'application/json'}); let sURL = URL.createObjectURL(xBlob); Index: make.py ================================================================== --- make.py +++ make.py @@ -461,11 +461,13 @@ # Firefox Developper edition spfFirefox = dVars['win_fx_dev_path'] if platform.system() == "Windows" else dVars['linux_fx_dev_path'] else: # Firefox Nightly edition spfFirefox = dVars['win_fx_nightly_path'] if platform.system() == "Windows" else dVars['linux_fx_nightly_path'] - os.system(r'web-ext run --firefox="' + spfFirefox + '" --browser-console --firefox-profile=debug') + #os.system(r'web-ext run --firefox="' + spfFirefox + '" --browser-console --firefox-profile=debug') + # https://github.com/mozilla/web-ext/issues/932 + os.system(r'web-ext run --firefox="' + spfFirefox + r'" --browser-console --firefox-profile=C:\Users\EAK\AppData\Roaming\Mozilla\Firefox\Profiles\e26559tw.debug --keep-profile-changes') # Thunderbird if xArgs.thunderbird: os.system("thunderbird -jsconsole -P debug") else: