Grammalecte  Check-in [99316730f8]

Overview
Comment:[fx][tb] editor: blockquote are parsed now
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | tb | fx
Files: files | file ages | folders
SHA3-256: 99316730f812181bb6b42e33ad59720345045e455406989579a119ec137cb0e5
User & Date: olr on 2020-10-21 13:03:45
Other Links: manifest | tags
Context
2020-10-22
13:44
[fr] ajustements check-in: 1808702687 user: olr tags: trunk, fr
2020-10-21
13:03
[fx][tb] editor: blockquote are parsed now check-in: 99316730f8 user: olr tags: trunk, tb, fx
08:40
[fr] ajustements check-in: 37eb092eab user: olr tags: trunk, fr
Changes

Modified gc_lang/fr/webext/content_scripts/editor.js from [058bd04e59] to [4d28a215de].

60
61
62
63
64
65
66
67

68
69
70
71
72
73
74
60
61
62
63
64
65
66

67
68
69
70
71
72
73
74







-
+







    },

    setParagraph: function (iParagraph, sParagraph) {
        this.dParagraphs.set(iParagraph, this.purgeText(sParagraph).normalize("NFC"));
    },

    purgeText: function (sText) {
        console.log(sText);
        //console.log(sText);
        // return sText.replace(/&nbsp;/g, " ").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/\r\n/g, "\n").replace(/\r/g, "\n"); // probably useless now
        return sText.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
    },

    clear: function () {
        this.dParagraphs.clear();
    }
105
106
107
108
109
110
111
112

113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129



130

131
132
133
134
135
136
137
105
106
107
108
109
110
111

112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127


128
129
130
131
132
133
134
135
136
137
138
139







-
+















-
-
+
+
+

+







        if (xResultNode instanceof HTMLElement) {
            this.xResultNode = xResultNode;
            this.bResultInEvent = true;
        }
        this.lNode = [];
        this.bCheckSignature = bCheckSignature;
        this._lParsableNodes = ["P", "LI", "H1", "H2", "H3", "H4", "H5", "H6"];
        this._lRootNodes = ["DIV", "UL", "OL"];
        this._lRootNodes = ["DIV", "UL", "OL", "BLOCKQUOTE"];
        if (!this.bWrite) {
            // we don’t write back to the page
            oGrammalecte.oGCPanel.addMessageToGCPanel(oGrammalecteMessages["excluded_site"]);
            oGrammalecte.oGCPanel.highlightClipboardButton();
        } else {
            oGrammalecte.oGCPanel.addMessageToGCPanel(oGrammalecteMessages["format_warning"]);
        }
        let sText = this.getTextFromPage();
        oGrammalecteTextEditor.loadText(sText);
    }

    * _getParsableNodes (xRootNode) {
        // recursive function
        try {
            for (let xNode of xRootNode.childNodes) {
                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(">")))
                if (xNode.className !== "moz-cite-prefix" && xNode.className !== "moz-forward-container"
                    && ! (bThunderbird && xNode.tagName == "BLOCKQUOTE" && xNode.cite)
                    && ( xNode.nodeType == Node.TEXT_NODE || (xNode.nodeType == Node.ELEMENT_NODE && !xNode.textContent.startsWith(">")) )
                    && xNode.textContent !== "") {
                    // console.log("tag:", xNode.tagName, "class:", xNode.className, " nodeType:", xNode.nodeType, " type:", xNode.type);
                    if (xNode.tagName === undefined) {
                        if (!this.bCheckSignature && xNode.textContent.startsWith("-- ")) {
                            break;
                        }
                        yield xNode;
                    }
                    else if (this._lParsableNodes.includes(xNode.tagName)) {