Grammalecte  Check-in [718aa993a2]

Overview
Comment:[fx][tb] editor: prevent inconsistency of text content by removing possible carriage return
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | tb | fx
Files: files | file ages | folders
SHA3-256: 718aa993a2ee127fe481f2261699e0f89c40fa5f7361e6fcc6abfaac32b5ad29
User & Date: olr on 2020-08-13 11:22:35
Other Links: manifest | tags
Context
2020-08-14
09:02
[fr] ajustements check-in: 4ff8ad61af user: olr tags: trunk, fr
2020-08-13
11:22
[fx][tb] editor: prevent inconsistency of text content by removing possible carriage return check-in: 718aa993a2 user: olr tags: trunk, tb, fx
09:39
[fr] ajustements check-in: 6838a7b68a user: olr tags: trunk, fr
Changes

Modified gc_lang/fr/webext/content_scripts/editor.js from [dc19e7b8ee] to [5de9b2b371].

99
100
101
102
103
104
105
106

107
108
109
110
111
112
113
99
100
101
102
103
104
105

106
107
108
109
110
111
112
113







-
+







        oGrammalecteTextEditor.loadText(sText);
    }

    * _getParsableNodes (xRootNode) {
        // recursive function
        try {
            for (let xNode of xRootNode.childNodes) {
                if (xNode.className !== "moz-cite-prefix" && xNode.tagName !== "BLOCKQUOTE"
                if (xNode.className !== "moz-cite-prefix" && xNode.className !== "moz-forward-container" && xNode.tagName !== "BLOCKQUOTE"
                    && (xNode.nodeType == Node.TEXT_NODE || (xNode.nodeType == Node.ELEMENT_NODE && !xNode.textContent.startsWith(">")))
                    && xNode.textContent !== "") {
                    if (xNode.tagName === undefined) {
                        if (!this.bCheckSignature && xNode.textContent.startsWith("-- ")) {
                            break;
                        }
                        yield xNode;
129
130
131
132
133
134
135
136

137
138
139
140
141
142
143
129
130
131
132
133
134
135

136
137
138
139
140
141
142
143







-
+







    getTextFromPage () {
        try {
            // return this.xRootNode.innerText;
            let sPageText = "";
            for (let xNode of this._getParsableNodes(this.xRootNode)) {
                if (xNode.textContent.trim() !== "") {
                    this.lNode.push(xNode);
                    sPageText += xNode.textContent + "\n";
                    sPageText += xNode.textContent.replace(/\n/g, "") + "\n";
                }
            }
            //console.log(sPageText);
            return sPageText.slice(0,-1).normalize("NFC");
        }
        catch (e) {
            showError(e);