14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
constructor (xDocument, bCheckSignature=false) {
this.xDocument = xDocument;
this.xRootNode = xDocument.body;
//console.log(xDocument.body);
//console.log(xDocument.body.innerHTML);
this.lNode = [];
this.bCheckSignature = bCheckSignature;
this._lParsableNodes = ["P", "LI", "H1", "H2", "H3", "H4", "H5"];
this._lRootNodes = ["DIV", "UL", "OL"];
}
* _getParsableNodes (xRootNode) {
// recursive function
try {
for (let xNode of xRootNode.childNodes) {
|
|
|
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
constructor (xDocument, bCheckSignature=false) {
this.xDocument = xDocument;
this.xRootNode = xDocument.body;
//console.log(xDocument.body);
//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"];
}
* _getParsableNodes (xRootNode) {
// recursive function
try {
for (let xNode of xRootNode.childNodes) {
|
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
catch (e) {
showError(e);
}
}
setParagraph (iPara, sText) {
try {
return this.lNode[iPara].textContent = sText;
}
catch (e) {
showError(e);
}
}
changeParagraph (iPara, sModif, iStart, iEnd) {
|
|
|
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
catch (e) {
showError(e);
}
}
setParagraph (iPara, sText) {
try {
return this.lNode[iPara].textContent = oGrammalecte.purgeText(sText);
}
catch (e) {
showError(e);
}
}
changeParagraph (iPara, sModif, iStart, iEnd) {
|
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
|
}
getText () {
return [...this.dParagraph.values()].join("\n").normalize("NFC");
}
setParagraph (iParagraph, sText) {
this.dParagraph.set(iParagraph, sText);
this.write();
}
getParagraph (iParaNum) {
return this.dParagraph.get(iParaNum);
}
|
|
|
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
|
}
getText () {
return [...this.dParagraph.values()].join("\n").normalize("NFC");
}
setParagraph (iParagraph, sText) {
this.dParagraph.set(iParagraph, oGrammalecte.purgeText(sText));
this.write();
}
getParagraph (iParaNum) {
return this.dParagraph.get(iParaNum);
}
|