Grammalecte  Check-in [e1f9580c26]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:[fx] gc panel: refresh with blur event (not a so good idea?)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | fx
Files: files | file ages | folders
SHA3-256:e1f9580c262c3ff32228a24134af3bec3930acdb820532b20dcb7f3fd89bfebc
User & Date: olr 2019-05-20 13:22:27
Context
2019-05-20
14:10
[fx] gc panel: autorefresh as option check-in: a7d3941648 user: olr tags: fx, trunk
13:22
[fx] gc panel: refresh with blur event (not a so good idea?) check-in: e1f9580c26 user: olr tags: fx, trunk
12:18
[fx] gc panel: CSS adjustements and auto-refresh adjustements check-in: e4791e17bb user: olr tags: fx, trunk
Changes

Changes to gc_lang/fr/webext/content_scripts/panel_gc.js.

225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
...
416
417
418
419
420
421
422

423
424
425
426
427
428
429
430
431
432
                    xParagraph.dataset.caret_position_start = nStart;
                    xParagraph.dataset.caret_position_end = nEnd;
                    // write text
                    this.oTextControl.setParagraph(parseInt(xEvent.target.dataset.para_num), this.purgeText(xEvent.target.textContent));
                    this.oTextControl.write();
                }.bind(this)
                , true);
                xParagraph.addEventListener("blur", function (xEvent) {
                    // remove timer for refreshing analysis
                    window.clearTimeout(parseInt(xParagraph.dataset.timer_id));
                    // unset caret position
                    xParagraph.dataset.caret_position_start = "-1";
                    xParagraph.dataset.caret_position_end = "-1";
                    // recheck
                    this.recheckParagraph(oResult.iParaNum);
                }.bind(this)
                , true);
                this._tagParagraph(xParagraph, oResult.sParagraph, oResult.iParaNum, oResult.aGrammErr, oResult.aSpellErr);
                // creation
                xNodeDiv.appendChild(xActionsBar);
                xNodeDiv.appendChild(xParagraph);
                this.xParagraphList.appendChild(xNodeDiv);
            }
        }
................................................................................
            showError(e);
        }
        this.stopWaitIcon();
    }

    _sendTextToClipboard (sText)  {
        this.xClipboardButton.textContent = "⇒ presse-papiers";

        // Firefox 63+, Chrome 66+
        // Working draft: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard
        if (navigator.clipboard && navigator.clipboard.writeText) {
            navigator.clipboard.writeText(sText)
            .then(
                (res) => { window.setTimeout(() => { this.xClipboardButton.textContent = "📋"; }, 2000); }
            )
            .catch(
                (e) => { console.error(e); this._sendTextToClipboard(sText); }
            );







|








|







 







>
|
|
<







225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
...
416
417
418
419
420
421
422
423
424
425

426
427
428
429
430
431
432
                    xParagraph.dataset.caret_position_start = nStart;
                    xParagraph.dataset.caret_position_end = nEnd;
                    // write text
                    this.oTextControl.setParagraph(parseInt(xEvent.target.dataset.para_num), this.purgeText(xEvent.target.textContent));
                    this.oTextControl.write();
                }.bind(this)
                , true);
                /*xParagraph.addEventListener("blur", function (xEvent) {
                    // remove timer for refreshing analysis
                    window.clearTimeout(parseInt(xParagraph.dataset.timer_id));
                    // unset caret position
                    xParagraph.dataset.caret_position_start = "-1";
                    xParagraph.dataset.caret_position_end = "-1";
                    // recheck
                    this.recheckParagraph(oResult.iParaNum);
                }.bind(this)
                , true);*/
                this._tagParagraph(xParagraph, oResult.sParagraph, oResult.iParaNum, oResult.aGrammErr, oResult.aSpellErr);
                // creation
                xNodeDiv.appendChild(xActionsBar);
                xNodeDiv.appendChild(xParagraph);
                this.xParagraphList.appendChild(xNodeDiv);
            }
        }
................................................................................
            showError(e);
        }
        this.stopWaitIcon();
    }

    _sendTextToClipboard (sText)  {
        this.xClipboardButton.textContent = "⇒ presse-papiers";
        if (navigator.hasOwnProperty("clipboard") && navigator.clipboard.hasOwnProperty("writeText")) {
            // Firefox 63+, Chrome 66+
            // Working draft: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard

            navigator.clipboard.writeText(sText)
            .then(
                (res) => { window.setTimeout(() => { this.xClipboardButton.textContent = "📋"; }, 2000); }
            )
            .catch(
                (e) => { console.error(e); this._sendTextToClipboard(sText); }
            );