From 0f83d777a1b7d362c7ad0ecb9d1cead1a7114d3a Mon Sep 17 00:00:00 2001 From: Robert Anderson Date: Thu, 29 Oct 2020 16:12:29 +1100 Subject: [PATCH] WordPress 5.5.2 Backports (#26562) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Refactor BlockMover to use React hooks (#24774) * Add drag handle to block toolbar (#24852) * Add drag handle to block mover component * Switch draggable chip to reflect toolbar layout * Use drag cursor * Hide drag handle on mobile or in top toolbar mode * Adjust handle and structure. * Size the switcher. * Adjust mover. * Update icon for handle. * Update movers buttons. * Fix groups. * Focus for switcher. * Handle focus. * Fix top toolbar. * Popover fix. * Fix spacing issue. * Harmonize spacing. * Try small independen transition for up / down. * Reduce motion. * use dragHandle icon in draggable chip * Make draggable chip use same icon as toolbar * Revert "Make draggable chip use same icon as toolbar" This reverts commit d031006bfd4c3e406964f8736c08548fd04f2d6c. * Revert offset change and ensure cursor does not overlap chip block info * Update snapshots to reflect chevron icon change Co-authored-by: jasmussen Co-authored-by: Matías Ventura * Fix issue with single block. (#25107) * Remove animation from mover buttons. (#25728) The animation was intended to better convey direction, and were added as an experiment. It doesn't seem successful, so let's remove it again. * add label in drag and drop button (#25606) * Change toolbar drag remove labels (#25614) * Refactor toolabar drag+remove labels * fix tests * fixes #24845 (#24847) * Fix: Post schedule label showing wrong time if site and user timezones did not match (#26212) * URLInput: Use debounce() instead of throttle() (#26529) Wait until the user finishes typing before sending an AJAX request. This ensures that there isn't an AJAX request sent every 200 ms while the user is typing. * Update browserlist dependency (#24756) * Fix composer test failures due to invalid lock (#26472) * Update package-lock.json * Set dev environment to use WordPress 5.5 Co-authored-by: Chris Alexander Co-authored-by: Daniel Richards Co-authored-by: jasmussen Co-authored-by: Matías Ventura Co-authored-by: Joen A <1204802+jasmussen@users.noreply.github.com> Co-authored-by: Nik Tsekouras Co-authored-by: Ari Stathopoulos Co-authored-by: Jorge Costa Co-authored-by: Riad Benguella Co-authored-by: Marcus Kazmierczak --- .wp-env.json | 2 +- composer.json | 4 +- composer.lock | 78 +++++---- package-lock.json | 112 ++++++++----- package.json | 2 +- .../block-draggable/draggable-chip.js | 8 +- .../src/components/block-draggable/style.scss | 4 +- .../src/components/block-list/style.scss | 13 +- .../src/components/block-mover/index.js | 149 +++++++++--------- .../src/components/block-mover/style.scss | 26 ++- .../block-settings-dropdown.js | 4 +- .../src/components/block-switcher/style.scss | 7 +- .../src/components/block-toolbar/index.js | 27 +--- .../src/components/block-toolbar/style.scss | 25 +++ .../src/components/link-control/test/index.js | 8 +- .../src/components/url-input/index.js | 4 +- .../test/__snapshots__/index.js.snap | 4 +- packages/block-library/src/embed/editor.scss | 13 ++ .../test/__snapshots__/index.js.snap | 12 +- .../components/src/toolbar-group/style.scss | 3 +- .../specs/editor/plugins/cpt-locking.test.js | 4 +- .../editor/various/block-deletion.test.js | 2 +- .../test/__snapshots__/index.js.snap | 2 +- .../test/__snapshots__/index.js.snap | 3 +- .../src/components/post-schedule/label.js | 4 +- packages/icons/src/index.js | 1 + packages/icons/src/library/chevron-down.js | 2 +- packages/icons/src/library/chevron-up.js | 2 +- packages/icons/src/library/drag-handle.js | 17 ++ 29 files changed, 334 insertions(+), 208 deletions(-) create mode 100644 packages/icons/src/library/drag-handle.js diff --git a/.wp-env.json b/.wp-env.json index 943f4d0399eead..e8da77281a0698 100644 --- a/.wp-env.json +++ b/.wp-env.json @@ -1,5 +1,5 @@ { - "core": "WordPress/WordPress", + "core": "WordPress/WordPress#5.5-branch", "plugins": [ "." ], "mappings": { "wp-content/mu-plugins": "./packages/e2e-tests/mu-plugins", diff --git a/composer.json b/composer.json index 8c05013009be00..49d6605108cfef 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "issues": "https://github.com/WordPress/gutenberg/issues" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.6", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7", "squizlabs/php_codesniffer": "^3.5", "phpcompatibility/php-compatibility": "^9.3", "wp-coding-standards/wpcs": "^2.2", @@ -23,6 +23,6 @@ }, "scripts": { "format": "phpcbf --standard=phpcs.xml.dist --report-summary --report-source", - "lint": "phpcs --standard=phpcs.xml.dist" + "lint": "phpcs --standard=phpcs.xml.dist --runtime-set ignore_warnings_on_exit 1" } } diff --git a/composer.lock b/composer.lock index 9f485316022eb7..ca3dde5106f29d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "bcdce838e8354d08b1ed65eb1ebf3636", + "content-hash": "693be7bb8e616544f4b253f4a2168e04", "packages": [ { "name": "composer/installers", @@ -131,28 +131,38 @@ "zend", "zikula" ], + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], "time": "2020-04-07T06:57:05+00:00" } ], "packages-dev": [ { "name": "dealerdirect/phpcodesniffer-composer-installer", - "version": "v0.6.2", + "version": "v0.7.0", "source": { "type": "git", "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", - "reference": "8001af8eb107fbfcedc31a8b51e20b07d85b457a" + "reference": "e8d808670b8f882188368faaf1144448c169c0b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/8001af8eb107fbfcedc31a8b51e20b07d85b457a", - "reference": "8001af8eb107fbfcedc31a8b51e20b07d85b457a", + "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/e8d808670b8f882188368faaf1144448c169c0b7", + "reference": "e8d808670b8f882188368faaf1144448c169c0b7", "shasum": "" }, "require": { - "composer-plugin-api": "^1.0", - "php": "^5.3|^7", - "squizlabs/php_codesniffer": "^2|^3" + "composer-plugin-api": "^1.0 || ^2.0", + "php": ">=5.3", + "squizlabs/php_codesniffer": "^2 || ^3 || 4.0.x-dev" }, "require-dev": { "composer/composer": "*", @@ -199,7 +209,7 @@ "stylecheck", "tests" ], - "time": "2020-01-29T20:22:20+00:00" + "time": "2020-06-25T14:57:39+00:00" }, { "name": "phpcompatibility/php-compatibility", @@ -261,27 +271,27 @@ }, { "name": "sirbrillig/phpcs-variable-analysis", - "version": "v2.8.1", + "version": "v2.9.0", "source": { "type": "git", "url": "https://github.com/sirbrillig/phpcs-variable-analysis.git", - "reference": "5be26b4d719acaf7a433d1cad469159cbf034f2a" + "reference": "ff54d4ec7f2bd152d526fdabfeff639aa9b8be01" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/5be26b4d719acaf7a433d1cad469159cbf034f2a", - "reference": "5be26b4d719acaf7a433d1cad469159cbf034f2a", + "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/ff54d4ec7f2bd152d526fdabfeff639aa9b8be01", + "reference": "ff54d4ec7f2bd152d526fdabfeff639aa9b8be01", "shasum": "" }, "require": { - "php": ">=5.6.0", + "php": ">=5.4.0", "squizlabs/php_codesniffer": "^3.1" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4 || ^0.5 || ^0.6", - "limedeck/phpunit-detailed-printer": "^3.1", + "limedeck/phpunit-detailed-printer": "^3.1 || ^4.0 || ^5.0", "phpstan/phpstan": "^0.11.8", - "phpunit/phpunit": "^5.0 || ^6.5", + "phpunit/phpunit": "^5.0 || ^6.5 || ^7.0 || ^8.0", "sirbrillig/phpcs-import-detection": "^1.1" }, "type": "phpcodesniffer-standard", @@ -305,20 +315,20 @@ } ], "description": "A PHPCS sniff to detect problems with variables.", - "time": "2020-02-11T22:18:48+00:00" + "time": "2020-10-07T23:32:29+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "3.5.5", + "version": "3.5.8", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "73e2e7f57d958e7228fce50dc0c61f58f017f9f6" + "reference": "9d583721a7157ee997f235f327de038e7ea6dac4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/73e2e7f57d958e7228fce50dc0c61f58f017f9f6", - "reference": "73e2e7f57d958e7228fce50dc0c61f58f017f9f6", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/9d583721a7157ee997f235f327de038e7ea6dac4", + "reference": "9d583721a7157ee997f235f327de038e7ea6dac4", "shasum": "" }, "require": { @@ -356,20 +366,20 @@ "phpcs", "standards" ], - "time": "2020-04-17T01:09:41+00:00" + "time": "2020-10-23T02:01:07+00:00" }, { "name": "wp-coding-standards/wpcs", - "version": "2.2.1", + "version": "2.3.0", "source": { "type": "git", "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", - "reference": "b5a453203114cc2284b1a614c4953456fbe4f546" + "reference": "7da1894633f168fe244afc6de00d141f27517b62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/b5a453203114cc2284b1a614c4953456fbe4f546", - "reference": "b5a453203114cc2284b1a614c4953456fbe4f546", + "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/7da1894633f168fe244afc6de00d141f27517b62", + "reference": "7da1894633f168fe244afc6de00d141f27517b62", "shasum": "" }, "require": { @@ -379,6 +389,7 @@ "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || ^0.6", "phpcompatibility/php-compatibility": "^9.0", + "phpcsstandards/phpcsdevtools": "^1.0", "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" }, "suggest": { @@ -401,20 +412,20 @@ "standards", "wordpress" ], - "time": "2020-02-04T02:52:06+00:00" + "time": "2020-05-13T23:57:56+00:00" }, { "name": "wp-phpunit/wp-phpunit", - "version": "5.4.1", + "version": "5.5.1", "source": { "type": "git", "url": "https://github.com/wp-phpunit/wp-phpunit.git", - "reference": "15925e03c8594c08cf2822e24e511af8dc6f779e" + "reference": "763121e752594664c150643e05c991a0acf3800a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-phpunit/wp-phpunit/zipball/15925e03c8594c08cf2822e24e511af8dc6f779e", - "reference": "15925e03c8594c08cf2822e24e511af8dc6f779e", + "url": "https://api.github.com/repos/wp-phpunit/wp-phpunit/zipball/763121e752594664c150643e05c991a0acf3800a", + "reference": "763121e752594664c150643e05c991a0acf3800a", "shasum": "" }, "type": "library", @@ -444,7 +455,7 @@ "test", "wordpress" ], - "time": "2020-04-01T14:35:27+00:00" + "time": "2020-09-02T15:53:50+00:00" } ], "aliases": [], @@ -453,5 +464,6 @@ "prefer-stable": false, "prefer-lowest": false, "platform": [], - "platform-dev": [] + "platform-dev": [], + "plugin-api-version": "1.1.0" } diff --git a/package-lock.json b/package-lock.json index f90270128f8840..ccf756e0664f48 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21773,35 +21773,33 @@ } }, "browserslist": { - "version": "4.9.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.9.1.tgz", - "integrity": "sha512-Q0DnKq20End3raFulq6Vfp1ecB9fh8yUNV55s8sekaDDeqBaCtWlRHCUdaWyUeSSBJM7IbM6HcsyaeYqgeDhnw==", + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.14.0.tgz", + "integrity": "sha512-pUsXKAF2lVwhmtpeA3LJrZ76jXuusrNyhduuQs7CDFf9foT4Y38aQOserd2lMe5DSSrjf3fx34oHwryuvxAUgQ==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30001030", - "electron-to-chromium": "^1.3.363", - "node-releases": "^1.1.50" + "caniuse-lite": "^1.0.30001111", + "electron-to-chromium": "^1.3.523", + "escalade": "^3.0.2", + "node-releases": "^1.1.60" }, "dependencies": { "caniuse-lite": { - "version": "1.0.30001032", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001032.tgz", - "integrity": "sha512-8joOm7BwcpEN4BfVHtfh0hBXSAPVYk+eUIcNntGtMkUWy/6AKRCDZINCLe3kB1vHhT2vBxBF85Hh9VlPXi/qjA==", + "version": "1.0.30001117", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001117.tgz", + "integrity": "sha512-4tY0Fatzdx59kYjQs+bNxUwZB03ZEBgVmJ1UkFPz/Q8OLiUUbjct2EdpnXj0fvFTPej2EkbPIG0w8BWsjAyk1Q==", "dev": true }, - "node-releases": { - "version": "1.1.51", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.51.tgz", - "integrity": "sha512-1eQEs6HFYY1kMXQPOLzCf7HdjReErmvn85tZESMczdCNVWP3Y7URYLBAyYynuI7yef1zj4HN5q+oB2x67QU0lw==", - "dev": true, - "requires": { - "semver": "^6.3.0" - } + "electron-to-chromium": { + "version": "1.3.544", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.544.tgz", + "integrity": "sha512-jx6H7M1db76Q/dI3MadZC4qwNTvpiq8tdYEJswxexrIm5bH+LKRdg+VAteMF1tJJbBLrcuogE9N3nxT3Dp1gag==", + "dev": true }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "node-releases": { + "version": "1.1.60", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.60.tgz", + "integrity": "sha512-gsO4vjEdQaTusZAEebUWp2a5d7dF5DYoIpDG7WySnk7BuZDW+GPpHXoXXuYawRBr/9t5q54tirPz79kFIWg4dA==", "dev": true } } @@ -26213,6 +26211,12 @@ "integrity": "sha512-E9kK/bjtCQRpN1K28Xh4BlmP8egvZBGJJ+9GtnzOwt7mdqtrjHFuVGr7QJfdjBIKqrlU5duPf3pCBoDrkjVYFg==", "dev": true }, + "escalade": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.0.2.tgz", + "integrity": "sha512-gPYAU37hYCUhW5euPeR+Y74F7BL+IBsV93j5cvGriSaD1aG6MGsqsV1yamRdrWrb2j3aiZvb0X+UBOWpx3JWtQ==", + "dev": true + }, "escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -45151,10 +45155,16 @@ "integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==", "dev": true }, + "base64-js": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", + "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==", + "dev": true + }, "bl": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/bl/-/bl-4.0.2.tgz", - "integrity": "sha512-j4OH8f6Qg2bGuWfRiltT2HYGx0e1QcBTrK9KAHNMwMZdQnDZFk0ZSYIpADjYCB3U12nicC5tVJwSIhwOWjb4RQ==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.0.3.tgz", + "integrity": "sha512-fs4G6/Hu4/EE+F75J8DuN/0IpQqNjAdC7aEQv7Qt8MHGUH7Ckv2MwTEEeN9QehD0pfIDkMI1bkHYkKy7xHyKIg==", "dev": true, "requires": { "buffer": "^5.5.0", @@ -45171,13 +45181,13 @@ } }, "buffer": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz", - "integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.0.tgz", + "integrity": "sha512-cd+5r1VLBwUqTrmnzW+D7ABkJUM6mr7uv1dv+6jRw4Rcl7tFIFHDqHPL98LhpGFn3dbAt3gtLxtrWp4m1kFrqg==", "dev": true, "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4" + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" } }, "chownr": { @@ -45187,12 +45197,12 @@ "dev": true }, "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", + "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", "dev": true, "requires": { - "ms": "^2.1.1" + "ms": "2.1.2" } }, "extract-zip": { @@ -45226,6 +45236,12 @@ "debug": "4" } }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true + }, "mime-db": { "version": "1.44.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", @@ -45281,12 +45297,12 @@ } }, "tar-stream": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.3.tgz", - "integrity": "sha512-Z9yri56Dih8IaK8gncVPx4Wqt86NDmQTSh49XLZgjWpGZL9GK9HKParS2scqHCC4w6X9Gh2jwaU45V47XTKwVA==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.4.tgz", + "integrity": "sha512-o3pS2zlG4gxr67GmFYBLlq+dM8gyRGUOvsrHclSkvtVtQbjV0s/+ZE8OpICbaj8clrX3tjeHngYGP7rweaBnuw==", "dev": true, "requires": { - "bl": "^4.0.1", + "bl": "^4.0.3", "end-of-stream": "^1.4.1", "fs-constants": "^1.0.0", "inherits": "^2.0.3", @@ -53092,15 +53108,27 @@ "through": "^2.3.8" }, "dependencies": { + "base64-js": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", + "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==", + "dev": true + }, "buffer": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz", - "integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.0.tgz", + "integrity": "sha512-cd+5r1VLBwUqTrmnzW+D7ABkJUM6mr7uv1dv+6jRw4Rcl7tFIFHDqHPL98LhpGFn3dbAt3gtLxtrWp4m1kFrqg==", "dev": true, "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4" + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" } + }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true } } }, diff --git a/package.json b/package.json index 1f68f5b5b90f36..14c5b1c8ccc2d6 100644 --- a/package.json +++ b/package.json @@ -142,7 +142,7 @@ "babel-plugin-react-native-platform-specific-extensions": "1.1.1", "babel-plugin-require-context-hook": "1.0.0", "benchmark": "2.1.4", - "browserslist": "4.9.1", + "browserslist": "4.14.0", "chalk": "4.0.0", "commander": "4.1.0", "concurrently": "3.5.0", diff --git a/packages/block-editor/src/components/block-draggable/draggable-chip.js b/packages/block-editor/src/components/block-draggable/draggable-chip.js index 4deed6aaef7d0f..4cce7db9d08028 100644 --- a/packages/block-editor/src/components/block-draggable/draggable-chip.js +++ b/packages/block-editor/src/components/block-draggable/draggable-chip.js @@ -5,7 +5,7 @@ import { _n, sprintf } from '@wordpress/i18n'; import { getBlockType } from '@wordpress/blocks'; import { useSelect } from '@wordpress/data'; import { Flex, FlexItem } from '@wordpress/components'; -import { handle } from '@wordpress/icons'; +import { dragHandle } from '@wordpress/icons'; /** * Internal dependencies @@ -35,9 +35,6 @@ export default function BlockDraggableChip( { clientIds } ) { justify="center" className="block-editor-block-draggable-chip__content" > - - - { icon ? ( @@ -49,6 +46,9 @@ export default function BlockDraggableChip( { clientIds } ) { ) ) } + + + diff --git a/packages/block-editor/src/components/block-draggable/style.scss b/packages/block-editor/src/components/block-draggable/style.scss index 3bd00506ebd9ca..dde3c36deba12a 100644 --- a/packages/block-editor/src/components/block-draggable/style.scss +++ b/packages/block-editor/src/components/block-draggable/style.scss @@ -1,6 +1,8 @@ .block-editor-block-draggable-chip-wrapper { position: absolute; - top: -$block-toolbar-height - $grid-unit-15; + // Offset position so that cursor is centered over the drag handle. + top: -#{$block-toolbar-height / 2}; + left: 0; } .block-editor-block-draggable-chip { diff --git a/packages/block-editor/src/components/block-list/style.scss b/packages/block-editor/src/components/block-list/style.scss index be9b37b8c6ebd9..fa6cec99868c33 100644 --- a/packages/block-editor/src/components/block-list/style.scss +++ b/packages/block-editor/src/components/block-list/style.scss @@ -542,13 +542,18 @@ } .block-editor-block-mover:not(.is-horizontal) { + // Position SVGs. .block-editor-block-mover-button { - &.is-up-button svg { - margin-top: 3px; + &.is-up-button { + svg { + margin-top: 2px; + } } - &.is-down-button svg { - margin-bottom: 3px; + &.is-down-button { + svg { + margin-bottom: 3px; + } } &:focus::before { diff --git a/packages/block-editor/src/components/block-mover/index.js b/packages/block-editor/src/components/block-mover/index.js index 0b454962220431..cf23ed975e40b7 100644 --- a/packages/block-editor/src/components/block-mover/index.js +++ b/packages/block-editor/src/components/block-mover/index.js @@ -7,94 +7,99 @@ import classnames from 'classnames'; /** * WordPress dependencies */ + +import { dragHandle } from '@wordpress/icons'; import { ToolbarGroup, __experimentalToolbarItem as ToolbarItem, + Button, } from '@wordpress/components'; import { getBlockType } from '@wordpress/blocks'; -import { Component } from '@wordpress/element'; +import { useState } from '@wordpress/element'; import { withSelect } from '@wordpress/data'; +import { _n } from '@wordpress/i18n'; /** * Internal dependencies */ +import BlockDraggable from '../block-draggable'; import { BlockMoverUpButton, BlockMoverDownButton } from './button'; -export class BlockMover extends Component { - constructor() { - super( ...arguments ); - this.state = { - isFocused: false, - }; - this.onFocus = this.onFocus.bind( this ); - this.onBlur = this.onBlur.bind( this ); - } +function BlockMover( { + isFirst, + isLast, + clientIds, + isLocked, + isHidden, + rootClientId, + orientation, + hideDragHandle, +} ) { + const [ isFocused, setIsFocused ] = useState( false ); - onFocus() { - this.setState( { - isFocused: true, - } ); - } + const onFocus = () => setIsFocused( true ); + const onBlur = () => setIsFocused( false ); - onBlur() { - this.setState( { - isFocused: false, - } ); + if ( isLocked || ( isFirst && isLast && ! rootClientId ) ) { + return null; } - render() { - const { - isFirst, - isLast, - clientIds, - isLocked, - isHidden, - rootClientId, - orientation, - } = this.props; - const { isFocused } = this.state; - if ( isLocked || ( isFirst && isLast && ! rootClientId ) ) { - return null; - } - - // We emulate a disabled state because forcefully applying the `disabled` - // attribute on the buttons while it has focus causes the screen to change - // to an unfocused state (body as active element) without firing blur on, - // the rendering parent, leaving it unable to react to focus out. - return ( -
- - - { ( itemProps ) => ( - - ) } - - - { ( itemProps ) => ( - - ) } - - -
- ); - } + // We emulate a disabled state because forcefully applying the `disabled` + // attribute on the buttons while it has focus causes the screen to change + // to an unfocused state (body as active element) without firing blur on, + // the rendering parent, leaving it unable to react to focus out. + return ( +
+ { ! hideDragHandle && ( + + { ( { isDraggable, onDraggableStart, onDraggableEnd } ) => ( +
+ ); } export default withSelect( ( select, { clientIds } ) => { diff --git a/packages/block-editor/src/components/block-mover/style.scss b/packages/block-editor/src/components/block-mover/style.scss index 803943cd2de8b0..c68c4a72ddc6bc 100644 --- a/packages/block-editor/src/components/block-mover/style.scss +++ b/packages/block-editor/src/components/block-mover/style.scss @@ -13,28 +13,32 @@ // Show the mover in a single button under the contextual toolbar. .block-editor-block-mover { - .components-toolbar-group, + .block-editor-block-mover__move-button-container, .components-toolbar { flex: 1; // Increase touch targets on mobile. flex-direction: row; + border-right: none !important; @include break-small() { flex-direction: column; } } - &.is-horizontal .components-toolbar-group, + &.is-horizontal .block-editor-block-mover__move-button-container, &.is-horizontal .components-toolbar { flex-direction: row; } .block-editor-block-mover-button { @include break-small() { - padding: 0 !important; + // The !important modifier should be removed when https://github.com/WordPress/gutenberg/issues/24898 refactors the spacing grid. height: $block-toolbar-height/2; - width: $block-toolbar-height; + width: $block-toolbar-height - $grid-unit-15 / 2; + padding-right: $grid-unit-15 - $border-width !important; + padding-left: $grid-unit-15 / 2 !important; + min-width: $block-toolbar-height - $grid-unit-15 / 2 !important; } // Focus style. @@ -47,6 +51,20 @@ } } + .block-editor-block-mover__drag-handle { + width: $button-size-small; + cursor: grab; + + // The !important modifier should be removed when https://github.com/WordPress/gutenberg/issues/24898 refactors the spacing grid. + min-width: $button-size-small !important; + padding: 0 !important; + + &:focus::before { + left: 0 !important; + right: 0 !important; + } + } + // Position the icons correctly. @include break-small() { .components-toolbar-group .block-editor-block-mover-button.is-up-button, diff --git a/packages/block-editor/src/components/block-settings-menu/block-settings-dropdown.js b/packages/block-editor/src/components/block-settings-menu/block-settings-dropdown.js index 0bbfc229a30eca..f70e45124265ce 100644 --- a/packages/block-editor/src/components/block-settings-menu/block-settings-dropdown.js +++ b/packages/block-editor/src/components/block-settings-menu/block-settings-dropdown.js @@ -192,8 +192,8 @@ export function BlockSettingsDropdown( { shortcut={ shortcuts.remove } > { _n( - 'Remove Block', - 'Remove Blocks', + 'Remove block', + 'Remove blocks', count ) } diff --git a/packages/block-editor/src/components/block-switcher/style.scss b/packages/block-editor/src/components/block-switcher/style.scss index ca48ac5fe687d0..3f9e896114a986 100644 --- a/packages/block-editor/src/components/block-switcher/style.scss +++ b/packages/block-editor/src/components/block-switcher/style.scss @@ -20,6 +20,11 @@ } } +// Indent the popover to match the button position. +.block-editor-block-switcher__popover { + margin-left: 6px; +} + .components-button.block-editor-block-switcher__no-switcher-icon { width: $block-toolbar-height; @@ -46,8 +51,6 @@ .block-editor-block-toolbar .components-toolbar .components-button.block-editor-block-switcher__no-switcher-icon.has-icon.has-icon, .block-editor-block-toolbar .components-toolbar-group .components-button.block-editor-block-switcher__toggle.has-icon.has-icon, .block-editor-block-toolbar .components-toolbar .components-button.block-editor-block-switcher__toggle.has-icon.has-icon { - padding: 0; - .block-editor-block-icon { height: 100%; position: relative; diff --git a/packages/block-editor/src/components/block-toolbar/index.js b/packages/block-editor/src/components/block-toolbar/index.js index c6f1dc38989453..f640bc4ac50ca3 100644 --- a/packages/block-editor/src/components/block-toolbar/index.js +++ b/packages/block-editor/src/components/block-toolbar/index.js @@ -10,6 +10,7 @@ import { useSelect, useDispatch } from '@wordpress/data'; import { useRef } from '@wordpress/element'; import { useViewportMatch } from '@wordpress/compose'; import { getBlockType, hasBlockSupport } from '@wordpress/blocks'; +import { ToolbarGroup } from '@wordpress/components'; /** * Internal dependencies @@ -20,7 +21,6 @@ import BlockSwitcher from '../block-switcher'; import BlockControls from '../block-controls'; import BlockFormatControls from '../block-format-controls'; import BlockSettingsMenu from '../block-settings-menu'; -import BlockDraggable from '../block-draggable'; import { useShowMoversGestures } from './utils'; export default function BlockToolbar( { hideDragHandle } ) { @@ -105,26 +105,15 @@ export default function BlockToolbar( { hideDragHandle } ) { ) } { ( shouldShowVisualToolbar || isMultiToolbar ) && ( - + + + + ) } - { ( shouldShowVisualToolbar || isMultiToolbar ) && ( - - { ( { isDraggable, onDraggableStart, onDraggableEnd } ) => ( -
- -
- ) } -
- ) } { shouldShowVisualToolbar && ( <> { + callback.cancel = jest.fn(); + return callback; +} ); + const mockFetchSearchSuggestions = jest.fn(); jest.mock( '@wordpress/data/src/components/use-select', () => () => ( { diff --git a/packages/block-editor/src/components/url-input/index.js b/packages/block-editor/src/components/url-input/index.js index b567bc343243ae..5916224cd8675b 100644 --- a/packages/block-editor/src/components/url-input/index.js +++ b/packages/block-editor/src/components/url-input/index.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import { throttle, isFunction } from 'lodash'; +import { debounce, isFunction } from 'lodash'; import classnames from 'classnames'; import scrollIntoView from 'dom-scroll-into-view'; @@ -39,7 +39,7 @@ class URLInput extends Component { this.bindSuggestionNode = this.bindSuggestionNode.bind( this ); this.autocompleteRef = props.autocompleteRef || createRef(); this.inputRef = createRef(); - this.updateSuggestions = throttle( + this.updateSuggestions = debounce( this.updateSuggestions.bind( this ), 200 ); diff --git a/packages/block-editor/src/components/url-popover/test/__snapshots__/index.js.snap b/packages/block-editor/src/components/url-popover/test/__snapshots__/index.js.snap index f9a9d1725a36c1..e6a7a3231c5a95 100644 --- a/packages/block-editor/src/components/url-popover/test/__snapshots__/index.js.snap +++ b/packages/block-editor/src/components/url-popover/test/__snapshots__/index.js.snap @@ -24,7 +24,7 @@ exports[`URLPopover matches the snapshot in its default state 1`] = ` xmlns="http://www.w3.org/2000/svg" > } @@ -60,7 +60,7 @@ exports[`URLPopover matches the snapshot when the settings are toggled open 1`] xmlns="http://www.w3.org/2000/svg" > } diff --git a/packages/block-library/src/embed/editor.scss b/packages/block-library/src/embed/editor.scss index c4c30f1909e0dd..3535b8e9c1c3e5 100644 --- a/packages/block-library/src/embed/editor.scss +++ b/packages/block-library/src/embed/editor.scss @@ -45,3 +45,16 @@ bottom: 0; opacity: 0; } + +.wp-block[data-align="left"], +.wp-block[data-align="right"] { + > .wp-block-embed { + max-width: 360px; + width: 100%; + + // Unless these have a min-width, they collapse when floated. + .wp-block-embed__wrapper { + min-width: $break-zoomed-in; + } + } +} diff --git a/packages/components/src/color-picker/test/__snapshots__/index.js.snap b/packages/components/src/color-picker/test/__snapshots__/index.js.snap index ee3e5fc66b2a31..d704f3cd771725 100644 --- a/packages/components/src/color-picker/test/__snapshots__/index.js.snap +++ b/packages/components/src/color-picker/test/__snapshots__/index.js.snap @@ -164,7 +164,7 @@ exports[`ColorPicker should commit changes to all views on blur 1`] = ` xmlns="http://www.w3.org/2000/svg" > @@ -338,7 +338,7 @@ exports[`ColorPicker should commit changes to all views on keyDown = DOWN 1`] = xmlns="http://www.w3.org/2000/svg" > @@ -512,7 +512,7 @@ exports[`ColorPicker should commit changes to all views on keyDown = ENTER 1`] = xmlns="http://www.w3.org/2000/svg" > @@ -686,7 +686,7 @@ exports[`ColorPicker should commit changes to all views on keyDown = UP 1`] = ` xmlns="http://www.w3.org/2000/svg" > @@ -860,7 +860,7 @@ exports[`ColorPicker should only update input view for draft changes 1`] = ` xmlns="http://www.w3.org/2000/svg" > @@ -1034,7 +1034,7 @@ exports[`ColorPicker should render color picker 1`] = ` xmlns="http://www.w3.org/2000/svg" > diff --git a/packages/components/src/toolbar-group/style.scss b/packages/components/src/toolbar-group/style.scss index 08a3141f6b288e..68602ba472629b 100644 --- a/packages/components/src/toolbar-group/style.scss +++ b/packages/components/src/toolbar-group/style.scss @@ -6,7 +6,8 @@ flex-shrink: 0; flex-wrap: wrap; - & & { + // Unset for nested toolbar groups. Increase specificity. + & .components-toolbar-group.components-toolbar-group { border-width: 0; margin: 0; } diff --git a/packages/e2e-tests/specs/editor/plugins/cpt-locking.test.js b/packages/e2e-tests/specs/editor/plugins/cpt-locking.test.js index 08002328af1ede..e4f62ca47aeb36 100644 --- a/packages/e2e-tests/specs/editor/plugins/cpt-locking.test.js +++ b/packages/e2e-tests/specs/editor/plugins/cpt-locking.test.js @@ -40,7 +40,7 @@ describe( 'cpt locking', () => { ); await clickBlockToolbarButton( 'More options' ); expect( - await page.$x( '//button[contains(text(), "Remove Block")]' ) + await page.$x( '//button[contains(text(), "Remove block")]' ) ).toHaveLength( 0 ); }; @@ -172,7 +172,7 @@ describe( 'cpt locking', () => { ); await clickBlockToolbarButton( 'More options' ); const [ removeBlock ] = await page.$x( - '//button[contains(text(), "Remove Block")]' + '//button[contains(text(), "Remove block")]' ); await removeBlock.click(); expect( await getEditedPostContent() ).toMatchSnapshot(); diff --git a/packages/e2e-tests/specs/editor/various/block-deletion.test.js b/packages/e2e-tests/specs/editor/various/block-deletion.test.js index 56c5496e46151c..60b25677cd4885 100644 --- a/packages/e2e-tests/specs/editor/various/block-deletion.test.js +++ b/packages/e2e-tests/specs/editor/various/block-deletion.test.js @@ -45,7 +45,7 @@ const clickOnBlockSettingsMenuRemoveBlockButton = async () => { await page.keyboard.press( 'Tab' ); isRemoveButton = await page.evaluate( () => { - return document.activeElement.innerText.includes( 'Remove Block' ); + return document.activeElement.innerText.includes( 'Remove block' ); } ); // Stop looping once we find the button diff --git a/packages/edit-post/src/components/sidebar/plugin-post-publish-panel/test/__snapshots__/index.js.snap b/packages/edit-post/src/components/sidebar/plugin-post-publish-panel/test/__snapshots__/index.js.snap index aafa7c918f1795..a6062e7af7b6ba 100644 --- a/packages/edit-post/src/components/sidebar/plugin-post-publish-panel/test/__snapshots__/index.js.snap +++ b/packages/edit-post/src/components/sidebar/plugin-post-publish-panel/test/__snapshots__/index.js.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`PluginPostPublishPanel renders fill properly 1`] = `"

My panel content
"`; +exports[`PluginPostPublishPanel renders fill properly 1`] = `"

My panel content
"`; diff --git a/packages/edit-post/src/components/sidebar/plugin-pre-publish-panel/test/__snapshots__/index.js.snap b/packages/edit-post/src/components/sidebar/plugin-pre-publish-panel/test/__snapshots__/index.js.snap index 6087ec62497e5c..b14bc1c0458d22 100644 --- a/packages/edit-post/src/components/sidebar/plugin-pre-publish-panel/test/__snapshots__/index.js.snap +++ b/packages/edit-post/src/components/sidebar/plugin-pre-publish-panel/test/__snapshots__/index.js.snap @@ -1,3 +1,4 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`PluginPrePublishPanel renders fill properly 1`] = `"

My panel content
"`; +exports[`PluginPrePublishPanel renders fill properly 1`] = `"

My panel content
"`; +q diff --git a/packages/editor/src/components/post-schedule/label.js b/packages/editor/src/components/post-schedule/label.js index 91a025b703d13b..5f4c2cf7c5c777 100644 --- a/packages/editor/src/components/post-schedule/label.js +++ b/packages/editor/src/components/post-schedule/label.js @@ -2,14 +2,14 @@ * WordPress dependencies */ import { __ } from '@wordpress/i18n'; -import { dateI18n, __experimentalGetSettings } from '@wordpress/date'; +import { format, __experimentalGetSettings } from '@wordpress/date'; import { withSelect } from '@wordpress/data'; export function PostScheduleLabel( { date, isFloating } ) { const settings = __experimentalGetSettings(); return date && ! isFloating - ? dateI18n( + ? format( `${ settings.formats.date } ${ settings.formats.time }`, date ) diff --git a/packages/icons/src/index.js b/packages/icons/src/index.js index 58bf5c3d85af51..c83307d1a766f2 100644 --- a/packages/icons/src/index.js +++ b/packages/icons/src/index.js @@ -48,6 +48,7 @@ export { default as currencyDollar } from './library/currency-dollar'; export { default as currencyEuro } from './library/currency-euro'; export { default as currencyPound } from './library/currency-pound'; export { default as desktop } from './library/desktop'; +export { default as dragHandle } from './library/drag-handle'; export { default as edit } from './library/edit'; export { default as external } from './library/external'; export { default as file } from './library/file'; diff --git a/packages/icons/src/library/chevron-down.js b/packages/icons/src/library/chevron-down.js index 9f490ee61edff7..6e1436d2e7fd93 100644 --- a/packages/icons/src/library/chevron-down.js +++ b/packages/icons/src/library/chevron-down.js @@ -5,7 +5,7 @@ import { SVG, Path } from '@wordpress/primitives'; const chevronDown = ( - + ); diff --git a/packages/icons/src/library/chevron-up.js b/packages/icons/src/library/chevron-up.js index de4075c4394265..4a51856f4f892a 100644 --- a/packages/icons/src/library/chevron-up.js +++ b/packages/icons/src/library/chevron-up.js @@ -5,7 +5,7 @@ import { SVG, Path } from '@wordpress/primitives'; const chevronUp = ( - + ); diff --git a/packages/icons/src/library/drag-handle.js b/packages/icons/src/library/drag-handle.js new file mode 100644 index 00000000000000..d67765bbd2c441 --- /dev/null +++ b/packages/icons/src/library/drag-handle.js @@ -0,0 +1,17 @@ +/** + * WordPress dependencies + */ +import { SVG, Path } from '@wordpress/primitives'; + +const dragHandle = ( + + + +); + +export default dragHandle;