From 111415aa33ae6c22be619dae32d0d01b7e428584 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Fri, 2 Jun 2023 19:55:53 +0200 Subject: [PATCH] wait #5984 @4 --- composer.json | 10 +- composer.lock | 106 +++++++++--------- .../linkeditor/js/linkeditor.clipboard.js | 42 ++++--- resources/linkeditor/js/linkeditor.js | 3 +- resources/linkeditor/js/linkeditor.links.js | 1 + resources/linkeditor/js/linkeditor.utils.js | 2 +- 6 files changed, 90 insertions(+), 74 deletions(-) diff --git a/composer.json b/composer.json index 7062f09a9..15454517f 100644 --- a/composer.json +++ b/composer.json @@ -43,21 +43,21 @@ "fluidbook/tools": "dev-master", "hollodotme/fast-cgi-client": "^3.1.7", "jolicode/slack-php-api": "^v4.5.0", - "jsvrcek/ics": "^0.8.4", + "jsvrcek/ics": "^0.8.5", "laravel-notification-channels/webpush": "^7.1", "league/csv": "^9.9.0", "mxl/laravel-job": "dev-master", - "nyholm/psr7": "^1.5.1", + "nyholm/psr7": "^1.8.0", "php-ffmpeg/php-ffmpeg": "^v1.1.0", "rodneyrehm/plist": "^2.0", "rustici-software/scormcloud-api-v2-client-php": "^2.1.0", - "symfony/http-client": "^v6.2.8" + "symfony/http-client": "^v6.3.0" }, "require-dev": { - "spatie/laravel-ignition": "^2.0.0", + "spatie/laravel-ignition": "^2.1.3", "mockery/mockery": "^1.5.1", "nunomaduro/collision": "^v6.4.0", - "phpunit/phpunit": "^9.6.6", + "phpunit/phpunit": "^9.6.8", "barryvdh/laravel-ide-helper": "^v2.13.0", "laravel/tinker": "^v2.8.1" }, diff --git a/composer.lock b/composer.lock index 74672ddf0..af7a28884 100644 --- a/composer.lock +++ b/composer.lock @@ -2440,16 +2440,16 @@ }, { "name": "doctrine/dbal", - "version": "3.6.2", + "version": "3.6.3", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "b4bd1cfbd2b916951696d82e57d054394d84864c" + "reference": "9a747d29e7e6b39509b8f1847e37a23a0163ea6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/b4bd1cfbd2b916951696d82e57d054394d84864c", - "reference": "b4bd1cfbd2b916951696d82e57d054394d84864c", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/9a747d29e7e6b39509b8f1847e37a23a0163ea6a", + "reference": "9a747d29e7e6b39509b8f1847e37a23a0163ea6a", "shasum": "" }, "require": { @@ -2462,12 +2462,12 @@ "psr/log": "^1|^2|^3" }, "require-dev": { - "doctrine/coding-standard": "11.1.0", + "doctrine/coding-standard": "12.0.0", "fig/log-test": "^1", "jetbrains/phpstorm-stubs": "2022.3", - "phpstan/phpstan": "1.10.9", + "phpstan/phpstan": "1.10.14", "phpstan/phpstan-strict-rules": "^1.5", - "phpunit/phpunit": "9.6.6", + "phpunit/phpunit": "9.6.7", "psalm/plugin-phpunit": "0.18.4", "squizlabs/php_codesniffer": "3.7.2", "symfony/cache": "^5.4|^6.0", @@ -2532,7 +2532,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/3.6.2" + "source": "https://github.com/doctrine/dbal/tree/3.6.3" }, "funding": [ { @@ -2548,7 +2548,7 @@ "type": "tidelift" } ], - "time": "2023-04-14T07:25:38+00:00" + "time": "2023-06-01T05:46:46+00:00" }, { "name": "doctrine/deprecations", @@ -2891,16 +2891,16 @@ }, { "name": "dragon-code/contracts", - "version": "v2.19.1", + "version": "v2.20.0", "source": { "type": "git", "url": "https://github.com/TheDragonCode/contracts.git", - "reference": "644ac91d9df96ebec3a46c0d2cc8ff51a83cbfad" + "reference": "410d35bec404f465a126bb1e672f3abe1150f5d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/TheDragonCode/contracts/zipball/644ac91d9df96ebec3a46c0d2cc8ff51a83cbfad", - "reference": "644ac91d9df96ebec3a46c0d2cc8ff51a83cbfad", + "url": "https://api.github.com/repos/TheDragonCode/contracts/zipball/410d35bec404f465a126bb1e672f3abe1150f5d7", + "reference": "410d35bec404f465a126bb1e672f3abe1150f5d7", "shasum": "" }, "require": { @@ -2959,31 +2959,31 @@ "type": "yoomoney" } ], - "time": "2023-04-19T08:23:59+00:00" + "time": "2023-06-02T11:06:31+00:00" }, { "name": "dragon-code/pretty-array", - "version": "v4.0.0", + "version": "v4.1.0", "source": { "type": "git", "url": "https://github.com/TheDragonCode/pretty-array.git", - "reference": "385ca81ee7e9a65fb5696692c173a1234fc2ad7d" + "reference": "6c84e2454491b414efbd37985c322712cdf9012f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/TheDragonCode/pretty-array/zipball/385ca81ee7e9a65fb5696692c173a1234fc2ad7d", - "reference": "385ca81ee7e9a65fb5696692c173a1234fc2ad7d", + "url": "https://api.github.com/repos/TheDragonCode/pretty-array/zipball/6c84e2454491b414efbd37985c322712cdf9012f", + "reference": "6c84e2454491b414efbd37985c322712cdf9012f", "shasum": "" }, "require": { - "dragon-code/contracts": "^2.6", - "dragon-code/support": "^6.0", + "dragon-code/contracts": "^2.20", + "dragon-code/support": "^6.11.2", "ext-dom": "*", "ext-mbstring": "*", "php": "^8.0" }, "require-dev": { - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^9.6 || ^10.2" }, "suggest": { "symfony/thanks": "Give thanks (in the form of a GitHub) to your fellow PHP package maintainers" @@ -3001,7 +3001,8 @@ "authors": [ { "name": "Andrey Helldar", - "email": "helldar@ai-rus.com" + "email": "helldar@dragon-code.pro", + "homepage": "https://github.com/andrey-helldar" } ], "description": "Simple conversion of an array to a pretty view", @@ -3019,15 +3020,11 @@ }, "funding": [ { - "url": "https://paypal.me/helldar", - "type": "custom" - }, - { - "url": "https://yoomoney.ru/to/410012608840929", - "type": "custom" + "url": "https://boosty.to/dragon-code", + "type": "boosty" }, { - "url": "https://github.com/TheDragonCode", + "url": "https://github.com/sponsors/TheDragonCode", "type": "github" }, { @@ -3035,11 +3032,11 @@ "type": "open_collective" }, { - "url": "https://www.patreon.com/andrey_helldar", - "type": "patreon" + "url": "https://yoomoney.ru/to/410012608840929", + "type": "yoomoney" } ], - "time": "2022-04-21T12:22:41+00:00" + "time": "2023-06-02T11:37:44+00:00" }, { "name": "dragon-code/support", @@ -3559,13 +3556,13 @@ "source": { "type": "git", "url": "git://git.cubedesigners.com/fluidbook_tools.git", - "reference": "1adb8d2123483221618fd629898c7bc7d8772c01" + "reference": "62113b9880ca6515de74ca7161f6293b7feafa44" }, "dist": { "type": "tar", - "url": "https://composer.cubedesigners.com/dist/fluidbook/tools/fluidbook-tools-dev-master-860403.tar", - "reference": "1adb8d2123483221618fd629898c7bc7d8772c01", - "shasum": "0184ffa09b64bb8d277667690b0749834e32ac9b" + "url": "https://composer.cubedesigners.com/dist/fluidbook/tools/fluidbook-tools-dev-master-5738ef.tar", + "reference": "62113b9880ca6515de74ca7161f6293b7feafa44", + "shasum": "dc6651251450309fcace894ac9b06b9781d5f307" }, "require": { "barryvdh/laravel-debugbar": "*", @@ -3599,7 +3596,7 @@ } ], "description": "Fluidbook Tools", - "time": "2023-06-01T09:28:07+00:00" + "time": "2023-06-01T09:36:30+00:00" }, { "name": "fruitcake/php-cors", @@ -4839,16 +4836,16 @@ }, { "name": "laravel/framework", - "version": "v10.13.0", + "version": "v10.13.1", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "7322723585103082758d74917db62980684845cb" + "reference": "c1569099594168870cb4bdabfbaa35e5d172310b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/7322723585103082758d74917db62980684845cb", - "reference": "7322723585103082758d74917db62980684845cb", + "url": "https://api.github.com/repos/laravel/framework/zipball/c1569099594168870cb4bdabfbaa35e5d172310b", + "reference": "c1569099594168870cb4bdabfbaa35e5d172310b", "shasum": "" }, "require": { @@ -5035,7 +5032,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-05-30T14:46:25+00:00" + "time": "2023-06-02T13:13:10+00:00" }, { "name": "laravel/serializable-closure", @@ -8967,16 +8964,16 @@ }, { "name": "spatie/laravel-backup", - "version": "8.1.10", + "version": "8.1.11", "source": { "type": "git", "url": "https://github.com/spatie/laravel-backup.git", - "reference": "a743a8bc21e388e5cc1bceff676859180f018771" + "reference": "e4f5c3f6783d40a219a02bc99dc4171ecdd6d20c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-backup/zipball/a743a8bc21e388e5cc1bceff676859180f018771", - "reference": "a743a8bc21e388e5cc1bceff676859180f018771", + "url": "https://api.github.com/repos/spatie/laravel-backup/zipball/e4f5c3f6783d40a219a02bc99dc4171ecdd6d20c", + "reference": "e4f5c3f6783d40a219a02bc99dc4171ecdd6d20c", "shasum": "" }, "require": { @@ -9050,7 +9047,7 @@ ], "support": { "issues": "https://github.com/spatie/laravel-backup/issues", - "source": "https://github.com/spatie/laravel-backup/tree/8.1.10" + "source": "https://github.com/spatie/laravel-backup/tree/8.1.11" }, "funding": [ { @@ -9062,7 +9059,7 @@ "type": "other" } ], - "time": "2023-05-02T07:30:18+00:00" + "time": "2023-06-02T08:56:10+00:00" }, { "name": "spatie/laravel-googletagmanager", @@ -14859,22 +14856,23 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.21.3", + "version": "1.22.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "b0c366dd2cea79407d635839d25423ba07c55dd6" + "reference": "ec58baf7b3c7f1c81b3b00617c953249fb8cf30c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/b0c366dd2cea79407d635839d25423ba07c55dd6", - "reference": "b0c366dd2cea79407d635839d25423ba07c55dd6", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/ec58baf7b3c7f1c81b3b00617c953249fb8cf30c", + "reference": "ec58baf7b3c7f1c81b3b00617c953249fb8cf30c", "shasum": "" }, "require": { "php": "^7.2 || ^8.0" }, "require-dev": { + "doctrine/annotations": "^2.0", "nikic/php-parser": "^4.15", "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/extension-installer": "^1.0", @@ -14899,9 +14897,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.21.3" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.22.0" }, - "time": "2023-05-29T19:31:28+00:00" + "time": "2023-06-01T12:35:21+00:00" }, { "name": "phpunit/php-code-coverage", diff --git a/resources/linkeditor/js/linkeditor.clipboard.js b/resources/linkeditor/js/linkeditor.clipboard.js index 63e14016a..f624f2843 100644 --- a/resources/linkeditor/js/linkeditor.clipboard.js +++ b/resources/linkeditor/js/linkeditor.clipboard.js @@ -8,7 +8,10 @@ function LinkeditorClipboard(linkeditor) { LinkeditorClipboard.prototype = { init: function () { - + if (!this.enabled()) { + return; + } + let $this = this; }, enabled: function () { @@ -24,24 +27,31 @@ LinkeditorClipboard.prototype = { if (this.enabled()) { navigator.clipboard.read() .then(items => { - items[0].getType('text/html').then(blob => { - blob.text().then(text => { - if (text.indexOf('') === 0) { - $this.content = text; - callback($this.content); - } + items[0].getType('text/html') + .then(blob => { + blob.text() + .then(text => { + if (text.indexOf('') === 0) { + $this.content = text; + callback($this.content); + } + }) + .catch(err => { + callback(this.content); + }); + }) + .catch(err => { + callback(this.content); }); - }); - }) - .catch(err => { - console.error('Failed to read clipboard contents: ', err); - }); + }).catch(err => { + callback(this.content); + }); } else { callback(this.content); } }, - isEmtpy: function () { + isEmpty: function () { if (!this.enabled()) { return this.content === ''; } @@ -52,9 +62,14 @@ LinkeditorClipboard.prototype = { if (!this.enabled()) { return; } + let $this = this; + this.get(function (content) { + $this._isEmpty = content === ''; + }); }, set: function (content) { + let $this = this; this.content = content; if (this.enabled()) { @@ -64,6 +79,7 @@ LinkeditorClipboard.prototype = { navigator.clipboard.write(data).then( () => { + $this.checkEmpty(); /* success */ }, () => { diff --git a/resources/linkeditor/js/linkeditor.js b/resources/linkeditor/js/linkeditor.js index 444928afd..1e91c3efa 100644 --- a/resources/linkeditor/js/linkeditor.js +++ b/resources/linkeditor/js/linkeditor.js @@ -89,8 +89,8 @@ LinkEditor.prototype = { init: function () { var $this = this; - this.clipboard = new LinkeditorClipboard(this); this.utils = new LinkeditorUtils(this); + this.clipboard = new LinkeditorClipboard(this); this.toolbar = new LinkeditorToolbar(this); this.resize = new LinkeditorResize(this); this.rulers = new LinkeditorRulers(this); @@ -157,6 +157,7 @@ LinkEditor.prototype = { $(window).on('focus', function () { if (!$this.windowHasFocus) { $this.windowHasFocus = true; + $this.clipboard.checkEmpty(); $this.resetKeyModifiers(); } }); diff --git a/resources/linkeditor/js/linkeditor.links.js b/resources/linkeditor/js/linkeditor.links.js index 262f02d39..a1c3cb272 100644 --- a/resources/linkeditor/js/linkeditor.links.js +++ b/resources/linkeditor/js/linkeditor.links.js @@ -223,6 +223,7 @@ LinkeditorLinks.prototype = { var selection = $(".link.selected"); var multiple = selection.length > 1; var hasSelection = selection.length > 0; + var hasClipboard = !$this.linkeditor.clipboard.isEmpty(); res.items = { 'select_all': { diff --git a/resources/linkeditor/js/linkeditor.utils.js b/resources/linkeditor/js/linkeditor.utils.js index e8b2b5d1b..36890b479 100644 --- a/resources/linkeditor/js/linkeditor.utils.js +++ b/resources/linkeditor/js/linkeditor.utils.js @@ -150,7 +150,7 @@ LinkeditorUtils.prototype = { isFirefox: function () { return navigator.userAgent.search("Firefox") >= 0; - } + }, }; module.exports = LinkeditorUtils; -- 2.39.5