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 @@ -18,10 +18,13 @@ //console.log(xDocument.body.innerHTML); this.lNode = []; this.bCheckSignature = bCheckSignature; this._lParsableNodes = ["P", "LI", "H1", "H2", "H3", "H4", "H5", "H6"]; this._lRootNodes = ["DIV", "UL", "OL"]; + if (bThunderbird) { + oGrammalecte.oGCPanel.addMessageToGCPanel("❗ Interface pour Thunderbird en version bêta."); + } } * _getParsableNodes (xRootNode) { // recursive function try { 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 @@ -60,10 +60,11 @@ this.oTooltip = new GrammalecteTooltip(this.xParent, this.xGCPanelContent); this.xPanelContent.appendChild(this.xGCPanelContent); this.oTextControl = null; this.nLastResult = 0; this.iLastEditedParagraph = -1; + this.nParagraph = 0; // Lexicographer this.nLxgCount = 0; this.xLxgPanelContent = oGrammalecte.createNode("div", {id: "grammalecte_lxg_panel_content"}); this.xPanelContent.appendChild(this.xLxgPanelContent); // Conjugueur @@ -149,11 +150,11 @@ // Text or node this.oTextControl = new TextNodeEditor(what, xResultNode); } else { // error - oGrammalecte.oMessageBox.showMessage("[BUG] Analyse d’un élément inconnu…"); + oGrammalecte.showMessage("[BUG] Analyse d’un élément inconnu…"); console.log("[Grammalecte] Unknown element:", what); } } setAutoRefreshButton () { @@ -214,10 +215,14 @@ } this.aIgnoredErrors.clear(); } hide () { + if (bThunderbird) { + oGrammalecte.showMessage("Veuillez patienter…"); + this.copyAllParagraphsToComposeWindow(); + } if (oGrammalecte.oTFPanel) { oGrammalecte.oTFPanel.hide(); } if (oGrammalecte.oMessageBox) { oGrammalecte.oMessageBox.hide(); } oGrammalecte.clearRightClickedNode(); this.xPanel.style.display = "none"; this.oTextControl.clear(); @@ -250,10 +255,11 @@ this._tagParagraph(xParagraph, oResult.sParagraph, oResult.iParaNum, oResult.aGrammErr, oResult.aSpellErr); // creation xNodeDiv.appendChild(xActionsBar); xNodeDiv.appendChild(xParagraph); this.xParagraphList.appendChild(xNodeDiv); + this.nParagraph += 1; } } catch (e) { showError(e); } @@ -441,10 +447,21 @@ } addSummary () { // todo } + + copyAllParagraphsToComposeWindow () { + // Thunderbird only + // When closing the window, we change all nodes according to the content of paragraphs in the gc panel + for (let iPara = 0; iPara < this.nParagraph; iPara++) { + let sParagraphId = "grammalecte_paragraph"+iPara; + if (this.xParent.getElementById(sParagraphId)) { + this.oTextControl.setParagraph(iPara, this.xParent.getElementById(sParagraphId).textContent); + } + } + } addMessageToGCPanel (sMessage) { let xNode = oGrammalecte.createNode("div", {className: "grammalecte_panel_flow_message", textContent: sMessage}); this.xParagraphList.appendChild(xNode); }