Grammalecte  Diff

Differences From Artifact [4bcac7be9b]:

To Artifact [4d321e586a]:


65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89

90

91
92
93
94
95
96
97
98
99
100







101
102
103
104
105
106
107

    getText () {
        try {
            let sPageText = "";
            for (let [i, sLine] of this.getParagraphs()) {
                sPageText += sLine + "\n";
            }
            return sPageText;
        }
        catch (e) {
            showError(e);
        }
    }

    getParagraph (iPara) {
        try {
            return this.lNode[iPara].textContent;
        }
        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) {
        let sText = this.getParagraph(iPara);
        this.writeParagraph(iPara, sText.slice(0, iStart) + sModif + sText.slice(iEnd));
    }








    clear () {
        this.xDocument = null;
        this.xRootNode = null;
        this.lNode.length = 0;
    }
}







|

















>
|
>










>
>
>
>
>
>
>







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116

    getText () {
        try {
            let sPageText = "";
            for (let [i, sLine] of this.getParagraphs()) {
                sPageText += sLine + "\n";
            }
            return sPageText.slice(0,-1).normalize("NFC");
        }
        catch (e) {
            showError(e);
        }
    }

    getParagraph (iPara) {
        try {
            return this.lNode[iPara].textContent;
        }
        catch (e) {
            showError(e);
        }
    }

    setParagraph (iPara, sText) {
        try {
            if (iPara < this.lNode.length) {
                this.lNode[iPara].textContent = oGrammalecte.purgeText(sText).normalize("NFC");
            }
        }
        catch (e) {
            showError(e);
        }
    }

    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;
    }
}
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);
    }








|







196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
    }

    getText () {
        return [...this.dParagraph.values()].join("\n").normalize("NFC");
    }

    setParagraph (iParagraph, sText) {
        this.dParagraph.set(iParagraph, oGrammalecte.purgeText(sText).normalize("NFC"));
        this.write();
    }

    getParagraph (iParaNum) {
        return this.dParagraph.get(iParaNum);
    }