Index: gc_lang/fr/tb/content/lex_editor.css ================================================================== --- gc_lang/fr/tb/content/lex_editor.css +++ gc_lang/fr/tb/content/lex_editor.css @@ -1,6 +1,10 @@ /* CSS */ + +button { + font-weight: bold; +} /* Dictionary */ .dictionary { Index: gc_lang/fr/tb/content/lex_editor.js ================================================================== --- gc_lang/fr/tb/content/lex_editor.js +++ gc_lang/fr/tb/content/lex_editor.js @@ -62,11 +62,10 @@ this.xNumEntry = document.getElementById(sResultId); this.iEntryIndex = 0; this.lEntry = []; this.nEntry = 0 this._createHeader(); - this.listen(); } _createHeader () { let xListheadNode = createNode("listhead"); for (let sColumn of this.lColumn) { @@ -126,36 +125,16 @@ } this.xTable.appendChild(xRowNode); this.iEntryIndex += 1; } - listen () { - this.xTable.addEventListener("click", (xEvent) => { this.onTableClick(xEvent); }, false); - } - - onTableClick (xEvent) { - try { - let xElem = xEvent.target; - console.log(xElem); - if (xElem.className) { - if (xElem.className.startsWith(this.sNodeId+"_item_")) { - console.log("!"); - this.deleteRow(xElem.value); - } - } - } - catch (e) { - showError(e); - } - } - - deleteRow (iEntry) { - this.lEntry[parseInt(iEntry)] = null; - if (document.getElementById(this.sNodeId + "_row_" + iEntry)) { - document.getElementById(this.sNodeId + "_row_" + iEntry).style.display = "none"; - } - this.nEntry -= 1; + deleteSelection () { + for (let xItem of this.xTable.selectedItems) { + this.lEntry[parseInt(xItem.value)] = null; + xItem.style.display = "none"; + this.nEntry -= 1; + } this.showEntryNumber(); } getEntries () { return this.lEntry.filter((e) => e !== null); @@ -210,10 +189,11 @@ document.getElementById("tag_X").addEventListener("click", () => { this.update("X"); }, false); document.getElementById("flexion").addEventListener("keyup", () => { this.update(); }, false); document.getElementById("tags").addEventListener("keyup", () => { this.update(); }, false); // ajout document.getElementById("add_to_lexicon").addEventListener("click", () => { this.addToLexicon(); }, false); + document.getElementById("delete_selection").addEventListener("click", () => { oGenWordsTable.deleteSelection(); }, false); }, clear: function () { try { // nom commun @@ -461,10 +441,11 @@ document.getElementById("dic_num_entries").value = nEntries; document.getElementById("dic_save_date").value = sDate; }, listen: function () { + document.getElementById("delete_button").addEventListener("click", () => { oLexiconTable.deleteSelection(); }, false); document.getElementById("save_button").addEventListener("click", () => { this.build(); }, false); document.getElementById("export_button").addEventListener("click", () => { this.export(); }, false); //document.getElementById("import_button").addEventListener("click", () => { this.import(); }, false); }, @@ -568,11 +549,12 @@ }); } } -const oLexiconTable = new Table("lexicon_table", ["Flexions", "Lemmes", "Étiquettes"], [10, 7, 10], "progress_lexicon", "num_entries"); const oGenWordsTable = new Table("generated_words_table", ["Flexions", "Étiquettes"], [1, 1], "progress_new_words"); +const oLexiconTable = new Table("lexicon_table", ["Flexions", "Lemmes", "Étiquettes"], [10, 7, 10], "progress_lexicon", "num_entries"); + oBinaryDict.load(); oBinaryDict.listen(); oGenerator.listen(); Index: gc_lang/fr/tb/content/lex_editor.xul ================================================================== --- gc_lang/fr/tb/content/lex_editor.xul +++ gc_lang/fr/tb/content/lex_editor.xul @@ -136,11 +136,11 @@ - + -