961
962
963
964
965
966
967
968
969
970
971
972
973
974
|
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
|
+
|
setText (sText) {
this.clear();
oGrammalecte.oGCPanel.addMessageToGCPanel("⛔ Aucun champ textuel défini. Les changements ne seront pas répercutés sur la zone d’où le texte a été extrait.");
this.loadText(sText);
}
loadText (sText) {
// function also used by the text formatter
if (typeof(sText) === "string") {
this.dParagraph.clear();
let i = 0;
let iStart = 0;
let iEnd = 0;
sText = sText.replace(/\r\n/g, "\n").replace(/\r/g, "\n").normalize("NFC");
while ((iEnd = sText.indexOf("\n", iStart)) !== -1) {
|
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
|
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
|
-
+
-
-
|
this.xNode.removeChild(this.xNode.firstChild);
}
}
write () {
if (this.xNode !== null) {
if (this.bResultInEvent) {
const xEvent = new CustomEvent("GrammalecteResult", {
const xEvent = new CustomEvent("GrammalecteResult", { detail: JSON.stringify({ text: this.getText() }) });
detail: JSON.stringify({ text: this.getText() })
});
this.xNode.dispatchEvent(xEvent);
//console.log("Text sent via an event :", xEvent.detail);
}
else if (this.bTextArea) {
this.xNode.value = this.getText();
}
else if (this.bIframe) {
|