Grammalecte  Check-in [f4a00c03d1]

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

Overview
Comment:[fx] gc panel: fix copy to clipboard again
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | fx
Files: files | file ages | folders
SHA3-256:f4a00c03d1caf6541e18bd7dbdb829e0e9e7a1ae449bf81bef4cee20a3fee2d0
User & Date: olr 2019-05-20 14:57:46
Context
2019-05-20
16:34
[build][fr] Dicollecte doesn’t exist anymore check-in: 2eeeb8f39d user: olr tags: build, fr, trunk
14:57
[fx] gc panel: fix copy to clipboard again check-in: f4a00c03d1 user: olr tags: fx, trunk
14:53
[fx] gc panel: prevent autorefresh after opening the tooltip check-in: 364440f87f user: olr tags: fx, trunk
Changes

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

428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
...
445
446
447
448
449
450
451

452
453
454
455
456
457
458
            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(
................................................................................
        } else {
            this._sendTextToClipboardFallback(sText);
        }
    }

    _sendTextToClipboardFallback (sText) {
        try {

            // Copy to clipboard fallback
            // recipe from https://github.com/mdn/webextensions-examples/blob/master/context-menu-copy-link-with-types/clipboard-helper.js
            function setClipboardData (xEvent) {
                document.removeEventListener("copy", setClipboardData, true);
                xEvent.stopImmediatePropagation();
                xEvent.preventDefault();
                xEvent.clipboardData.setData("text/plain", sText);







|







 







>







428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
...
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
            showError(e);
        }
        this.stopWaitIcon();
    }

    _sendTextToClipboard (sText)  {
        this.xClipboardButton.textContent = "β‡’ presse-papiers";
        if (navigator.clipboard && navigator.clipboard.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(
................................................................................
        } else {
            this._sendTextToClipboardFallback(sText);
        }
    }

    _sendTextToClipboardFallback (sText) {
        try {
            console.log("send text to clipboard fallback");
            // Copy to clipboard fallback
            // recipe from https://github.com/mdn/webextensions-examples/blob/master/context-menu-copy-link-with-types/clipboard-helper.js
            function setClipboardData (xEvent) {
                document.removeEventListener("copy", setClipboardData, true);
                xEvent.stopImmediatePropagation();
                xEvent.preventDefault();
                xEvent.clipboardData.setData("text/plain", sText);