Index: gc_lang/fr/webext/content_scripts/editor.js ================================================================== --- gc_lang/fr/webext/content_scripts/editor.js +++ gc_lang/fr/webext/content_scripts/editor.js @@ -67,11 +67,11 @@ try { let sPageText = ""; for (let [i, sLine] of this.getParagraphs()) { sPageText += sLine + "\n"; } - return sPageText; + return sPageText.slice(0,-1).normalize("NFC"); } catch (e) { showError(e); } } @@ -85,11 +85,13 @@ } } setParagraph (iPara, sText) { try { - return this.lNode[iPara].textContent = oGrammalecte.purgeText(sText); + if (iPara < this.lNode.length) { + this.lNode[iPara].textContent = oGrammalecte.purgeText(sText).normalize("NFC"); + } } catch (e) { showError(e); } } @@ -96,10 +98,17 @@ changeParagraph (iPara, sModif, iStart, iEnd) { let sText = this.getParagraph(iPara); this.writeParagraph(iPara, sText.slice(0, iStart) + sModif + sText.slice(iEnd)); } + + loadText (sText) { + let lParagraphs = sText.split("\n"); + for (let iPara = 0; iPara < lParagraphs.length; iPara++) { + this.setParagraph(iPara, lParagraphs[iPara]); + } + } clear () { this.xDocument = null; this.xRootNode = null; this.lNode.length = 0; @@ -189,11 +198,11 @@ getText () { return [...this.dParagraph.values()].join("\n").normalize("NFC"); } setParagraph (iParagraph, sText) { - this.dParagraph.set(iParagraph, oGrammalecte.purgeText(sText)); + this.dParagraph.set(iParagraph, oGrammalecte.purgeText(sText).normalize("NFC")); this.write(); } getParagraph (iParaNum) { return this.dParagraph.get(iParaNum);