Index: doc/API_web.md ================================================================== --- doc/API_web.md +++ doc/API_web.md @@ -107,10 +107,20 @@ ... } } For the last event, `oResult` will be `null`. + + +### Parse text and get errors + + oGrammalecteAPI.parseText(text, "node_id") + oGrammalecteAPI.parseText(text, node) + +The node must have an identifier. +Like with parseNode, results (for each paragraph) will be sent in a succession of events at the node. + ### Get spelling suggestions oGrammalecteAPI.getSpellingSuggestions(word, destination, request_identifier) 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 @@ -1023,17 +1023,12 @@ write () { if (this.xNode !== null) { if (this.bResultInEvent) { const xEvent = new CustomEvent("GrammalecteResult", { detail: JSON.stringify({ sType: "text", sText: this.getText() }) }); - if (this.xNode) { - this.xNode.dispatchEvent(xEvent); - } - else if (this.xResultNode) { - this.xResultNode.dispatchEvent(xEvent); - } - //console.log("Text sent via an event :", xEvent.detail); + this.xNode.dispatchEvent(xEvent); + //console.log("Text to xNode:", xEvent.detail); } else if (this.bTextArea) { this.xNode.value = this.getText(); } else if (this.bIframe) { @@ -1045,7 +1040,12 @@ this.xNode.appendChild(document.createTextNode(val.normalize("NFC"))); this.xNode.appendChild(document.createElement("br")); }); } } + else if (this.xResultNode !== null) { + const xEvent = new CustomEvent("GrammalecteResult", { detail: JSON.stringify({ sType: "text", sText: this.getText() }) }); + this.xResultNode.dispatchEvent(xEvent); + //console.log("Text to xResultNode:", xEvent.detail); + } } }