Index: gc_lang/fr/webext/content_scripts/api.js ================================================================== --- gc_lang/fr/webext/content_scripts/api.js +++ gc_lang/fr/webext/content_scripts/api.js @@ -9,11 +9,11 @@ sVersion: "1.0", generateNodeId: function (xNode) { xNode.id = "grammalecte_generated_id_" + Date.now().toString(36) + "_" + (Math.floor(Math.random() * (1000000))).toString(36); - console.log("[Grammalecte API] generated id", xNode.id); + console.log("[Grammalecte API] generated id:", xNode.id); return xNode.id; }, openPanelForNode: function (vNode) { // Parameter: a HTML node or the identifier of a HTML node Index: gc_lang/fr/webext/content_scripts/panel_gc.js ================================================================== --- gc_lang/fr/webext/content_scripts/panel_gc.js +++ gc_lang/fr/webext/content_scripts/panel_gc.js @@ -279,14 +279,13 @@ return; } let sParagraphId = "grammalecte_paragraph" + iParaNum; let xParagraph = this.xParent.getElementById(sParagraphId); this._blockParagraph(xParagraph); - let sText = this.purgeText(xParagraph.textContent); + //let sText = this.purgeText(xParagraph.textContent); + let sText = this.oTextControl.getParagraph(iParaNum); oGrammalecteBackgroundPort.parseAndSpellcheck1(sText, "__GrammalectePanel__", sParagraphId); - this.oTextControl.setParagraph(iParaNum, sText); - this.oTextControl.write(); } refreshParagraph (sParagraphId, oResult) { // function called when results are sent by the Worker if (!this.bOpened) { @@ -409,12 +408,15 @@ //let sParaNum = sErrorId.slice(0, sErrorId.indexOf("-")); let xNodeErr = this.xParent.getElementById("grammalecte_err" + sErrorId); xNodeErr.textContent = this.xParent.getElementById(sNodeSuggId).textContent; xNodeErr.className = "grammalecte_error_corrected"; xNodeErr.removeAttribute("style"); + let iParaNum = parseInt(sErrorId.slice(0, sErrorId.indexOf("-")), 10); + this.oTextControl.setParagraph(iParaNum, this.purgeText(this.xParent.getElementById("grammalecte_paragraph" + iParaNum).textContent)); + this.oTextControl.write(); this.oTooltip.hide(); - this.recheckParagraph(parseInt(sErrorId.slice(0, sErrorId.indexOf("-")), 10)); + this.recheckParagraph(iParaNum); } catch (e) { showError(e); } } @@ -1032,10 +1034,14 @@ } setParagraph (iParagraph, sText) { this.dParagraph.set(iParagraph, sText); } + + getParagraph (iParaNum) { + return this.dParagraph.get(iParaNum); + } eraseNodeContent () { while (this.xNode.firstChild) { this.xNode.removeChild(this.xNode.firstChild); }