Grammalecte  Diff

Differences From Artifact [f811c99bef]:

To Artifact [29929fcabe]:


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
        this.xTFButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Formateur de texte"});
        this.xEditorButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Éditeur"});
        this.xLxgButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Lexicographe"});
        this.xConjButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Conjugueur "});
        this.xLEButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Éditeur lexical "});
        this.xTFButton.onclick = () => {
            oGrammalecte.createTFPanel();
            if (this.xNode) {
                oGrammalecte.oTFPanel.start(this.xNode);
                oGrammalecte.oTFPanel.show();
                this.start(this.xNode);
                this.startWaitIcon();
                xGrammalectePort.postMessage({
                    sCommand: "parseAndSpellcheck",
                    dParam: {sText: this.getParsedText(), sCountry: "FR", bDebug: false, bContext: false},
                    dInfo: ((this.xNode) ? {sTextAreaId: this.xNode.id} : {})
                });
            } else {
                oGrammalecte.showMessage("Aucun node sur lequel appliquer le formatage de texte.")
            }
        };
        this.xEditorButton.onclick = () => {
            this.showEditor();
        };
        this.xLxgButton.onclick = () => {
            this.showLexicographer();







|
|

<
<
<
<
<
<
<

|







71
72
73
74
75
76
77
78
79
80







81
82
83
84
85
86
87
88
89
        this.xTFButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Formateur de texte"});
        this.xEditorButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Éditeur"});
        this.xLxgButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Lexicographe"});
        this.xConjButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Conjugueur "});
        this.xLEButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Éditeur lexical "});
        this.xTFButton.onclick = () => {
            oGrammalecte.createTFPanel();
            if (this.xNode  && (this.xNode.tagName == "TEXTAREA" || this.xNode.tagName == "INPUT" || this.xNode.isContentEditable)) {
                oGrammalecte.oTFPanel.start(this);
                oGrammalecte.oTFPanel.show();







            } else {
                oGrammalecte.showMessage("Aucune zone de texte éditable sur laquelle appliquer le formatage de texte.")
            }
        };
        this.xEditorButton.onclick = () => {
            this.showEditor();
        };
        this.xLxgButton.onclick = () => {
            this.showLexicographer();
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
        this.xMenu.appendChild(this.xLxgButton)
        this.xMenu.appendChild(this.xConjButton)
        this.xMenu.appendChild(this.xLEButton)
        this.xPanelBar.appendChild(this.xMenu);
    }

    start (xNode=null) {

        this.oTooltip.hide();
        this.clear();
        this.xNode = xNode;
        if (xNode) {
            this.oNodeControl.setNode(xNode);
            if (!(xNode.tagName == "TEXTAREA" || xNode.tagName == "INPUT")) {
                this.addMessage("Note : cette zone de texte n’est pas un champ de formulaire “textarea” mais un node HTML éditable. Une telle zone de texte est susceptible de contenir des éléments non textuels qui seront effacés lors de la correction.");
            }
        }
    }












    getParsedText () {
        if (this.xNode) {
            return (this.xNode.tagName == "TEXTAREA") ? this.xNode.value.normalize("NFC") : this.xNode.innerText.normalize("NFC");
        } else {
            return oGrammalecte.getPageText();
        }
    }

    showEditor () {
        this.xGCPanelContent.style.display = "block";







>


<







>
>
>
>
>
>
>
>
>
>
>



|







104
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
140
141
142
        this.xMenu.appendChild(this.xLxgButton)
        this.xMenu.appendChild(this.xConjButton)
        this.xMenu.appendChild(this.xLEButton)
        this.xPanelBar.appendChild(this.xMenu);
    }

    start (xNode=null) {
        this.xNode = xNode;
        this.oTooltip.hide();
        this.clear();

        if (xNode) {
            this.oNodeControl.setNode(xNode);
            if (!(xNode.tagName == "TEXTAREA" || xNode.tagName == "INPUT")) {
                this.addMessage("Note : cette zone de texte n’est pas un champ de formulaire “textarea” mais un node HTML éditable. Une telle zone de texte est susceptible de contenir des éléments non textuels qui seront effacés lors de la correction.");
            }
        }
    }

    recheckAll () {
        this.oTooltip.hide();
        this.clear();
        this.startWaitIcon();
        xGrammalectePort.postMessage({
            sCommand: "parseAndSpellcheck",
            dParam: {sText: this.getParsedText(), sCountry: "FR", bDebug: false, bContext: false},
            dInfo: ((this.xNode) ? {sTextAreaId: this.xNode.id} : {})
        });
    }

    getParsedText () {
        if (this.xNode) {
            return (this.xNode.tagName == "TEXTAREA" || this.xNode.tagName == "INPUT") ? this.xNode.value.normalize("NFC") : this.xNode.innerText.normalize("NFC");
        } else {
            return oGrammalecte.getPageText();
        }
    }

    showEditor () {
        this.xGCPanelContent.style.display = "block";