From 90b893ed8acb5232e2a5d9fa366d1e8c8afc6e59 Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Tue, 18 Jul 2023 15:40:02 +1000 Subject: [PATCH] Update/second round rc1 (#52677) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Try restoring the site editor animation (#51956) * Try restoring the site editor animation * fix header animation * Remove accidental addition of layout prop * tidy up formatting * fix animate presence issue * Fix animation between sidebar view and distraction free edit view * Leave sidebar present and maintain canvas to sidebar animation The sidebar is necessary for routing on mobile so we have to maintain its presence in the DOM. Just hiding it isn't enough though, as it is still able to be reached with keyboard tabs and screen readers. Using the relatively new `inert` property disables the element from user interaction, so we add that when we don't want the sidebar to be shown. * Fix mobile view for pattern library On Mobile, the canvas mode wasn't being set to edit when using the pattern library. This updates it to use the showSidbar value instead, keeping it in sync with the inert setting. --------- Co-authored-by: Saxon Fletcher Co-authored-by: Jerry Jones * Change password input to type text so contents are visible. (#52622) * Iframe: Silence style compat warnings when in a BlockPreview (#52627) * Do not autofocus page title field in the Create new page modal dialog. (#52603) * Use lowercase p in "Manage Patterns" (#52617) * Remove theme patterns title (#52570) * Block editor store: also attach private APIs to old store descriptor (#52088) As a workaround, until #39632 is merged, make sure that private actions and selectors can be unlocked from the original store descriptor (the one created by `createReduxStore`) and not just the one registered in the default registry (created by `registerStore`). Without this workaround, specific setups will unexpectedly fail, such as the action tests in the `reusable-blocks` package, due to the way that those tests create their own registries in which they register stores like `block-editor`. Context: https://github.com/WordPress/gutenberg/pull/51145#discussion_r1239999590 Props jsnajdr * Block removal prompt: let consumers pass their own rules (#51841) * Block removal prompt: let consumers pass their own rules Following up on #51145, this untangles `edit-site` from `block-editor` by removing the hard-coded set of rules `blockTypePromptMessages` from the generic `BlockRemovalWarningModal` component. Rules are now to be passed to that component by whichever block editor is using it. Names and comments have been updated accordingly and improved. * Site editor: Add e2e test for block removal prompt * Fix Shift+Tab to Block Toolbar (#52613) * Fix Shift+Tab to Block Toolbar * Add changelog entry * Show warning on removal of Post Template block in the site editor. (#52666) * Avoid copying global style presets via the styles compatibility hook (#52640) * i18n: Make the tab labels of `ColorGradientSettingsDropdown` component translatable (#52669) * Rich Text/Footnotes: fix getRichTextValues for useInnerBlocksProps.save (#52682) * Rich Text/Footnotes: fix getRichTextValues for useInnerBlocksProps.save * Address feedback * Patterns: Remove `reusable` text from menu once rename hint has been dismissed (#52664) * Show uncategorized patterns on the Editor > Patterns page (#52633) * Patterns: fix bug with Create Patterns menu not showing in site editor page editing (#52671) * Pass the root client id into the reusable blocks menu * Check that clientIds array is defined * Make check for array item more specific * Search block: Enqueue view script through block.json (#52552) * Search block: Enqueue view script through block.json * Remove extra space * Use `_get_block_template_file` function and set $area variable. (#52708) * Use `_get_block_template_file` function and set $area variable. * Update packages/block-library/src/template-part/index.php Co-authored-by: Felix Arntz --------- Co-authored-by: Felix Arntz * Site Editor: Don't allow creating template part on the Patterns page for non-block themes (#52656) * Don't allow template part to be created on the Patterns page for non-block themes * Remove unnecessary theme directory name in E2E test * Change Delete page menu item to Move to trash. (#52641) * Use relative path internally to include packages in dependencies (#52712) * Spacing Sizes: Fix zero size (#52711) * DimensionsPanel: Fix unexpected value decoding/encoding (#52661) --------- Co-authored-by: Daniel Richards Co-authored-by: Saxon Fletcher Co-authored-by: Jerry Jones Co-authored-by: Robert Anderson Co-authored-by: Andrea Fercia Co-authored-by: Rich Tabor Co-authored-by: James Koster Co-authored-by: Miguel Fonseca <150562+mcsf@users.noreply.github.com> Co-authored-by: Haz Co-authored-by: George Mamadashvili Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Co-authored-by: Ella <4710635+ellatrix@users.noreply.github.com> Co-authored-by: Glen Davies Co-authored-by: Carolina Nymark Co-authored-by: Petter Walbø Johnsgård Co-authored-by: Jonny Harris Co-authored-by: Felix Arntz Co-authored-by: Ramon Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> --- package-lock.json | 49 +++++----- packages/block-editor/README.md | 4 - .../block-removal-warning-modal/index.js | 40 +++----- .../components/colors-gradients/control.js | 5 +- .../global-styles/dimensions-panel.js | 10 +- .../src/components/iframe/index.js | 25 +++-- .../iframe/use-compatibility-styles.js | 5 + packages/block-editor/src/components/index.js | 5 - .../inserter/reusable-block-rename-hint.js | 17 ++++ .../rich-text/get-rich-text-values.js | 12 ++- .../hooks/use-spacing-sizes.js | 2 +- .../input-controls/axial.js | 19 +++- .../input-controls/separated.js | 19 +++- .../input-controls/single.js | 14 ++- .../components/spacing-sizes-control/utils.js | 2 +- packages/block-editor/src/private-apis.js | 6 ++ packages/block-editor/src/store/index.js | 10 ++ .../block-editor/src/store/private-actions.js | 69 +++++++------ .../src/store/private-selectors.js | 4 +- packages/block-editor/src/store/reducer.js | 24 +++-- .../block-editor/src/store/test/actions.js | 3 + packages/block-library/src/search/block.json | 1 + packages/block-library/src/search/index.php | 26 ++++- .../block-library/src/template-part/index.php | 24 ++--- packages/components/CHANGELOG.md | 1 + packages/components/package.json | 2 +- .../src/create-reusable-block.js | 4 - .../editor/various/reusable-blocks.test.js | 6 -- packages/edit-post/src/plugins/index.js | 2 +- .../src/components/add-new-page/index.js | 3 - .../src/components/add-new-pattern/index.js | 10 +- .../edit-site/src/components/editor/index.js | 16 ++- .../edit-site/src/components/layout/index.js | 81 ++++++++-------- .../src/components/page-actions/index.js | 4 +- ...e-menu-item.js => trash-page-menu-item.js} | 30 ++---- .../src/components/page-patterns/grid-item.js | 2 +- .../components/page-patterns/patterns-list.js | 17 +++- .../components/page-patterns/use-patterns.js | 16 ++- .../page-panels/page-status.js | 2 +- .../index.js | 23 ++--- .../style.scss | 12 +-- .../use-pattern-categories.js | 9 ++ .../src/components/post-sync-status/index.js | 5 +- packages/private-apis/src/implementation.js | 1 + packages/reusable-blocks/package.json | 1 + .../reusable-blocks-menu-items/index.js | 10 +- .../reusable-block-convert-button.js | 21 ++-- .../reusable-blocks-manage-button.js | 2 +- packages/reusable-blocks/src/lock-unlock.js | 9 ++ packages/reusable-blocks/src/store/actions.js | 6 +- .../editor/various/navigable-toolbar.spec.js | 15 +++ .../specs/site-editor/block-removal.spec.js | 97 +++++++++++++++++++ .../specs/site-editor/hybrid-theme.spec.js | 41 ++++++++ 53 files changed, 564 insertions(+), 279 deletions(-) rename packages/edit-site/src/components/page-actions/{delete-page-menu-item.js => trash-page-menu-item.js} (61%) create mode 100644 packages/reusable-blocks/src/lock-unlock.js create mode 100644 test/e2e/specs/site-editor/block-removal.spec.js create mode 100644 test/e2e/specs/site-editor/hybrid-theme.spec.js diff --git a/package-lock.json b/package-lock.json index 3c39cac1f8dcee..c1c23cff497d5c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -101,24 +101,24 @@ "dev": true }, "@ariakit/core": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/@ariakit/core/-/core-0.2.6.tgz", - "integrity": "sha512-83r2YmLvHLsV2NoclM5sfpLXfJ9S3R4lQIZK5Iad/KdfuFolvtVKPVrLW9OGoD1D4OuLxO1PgYKZEDPH0a1TjQ==" + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/@ariakit/core/-/core-0.2.7.tgz", + "integrity": "sha512-Hs0N1EMYq88WW4v9xnSIHNR38TvbQuoUX6FYFmeLCZSTIXQBiET7lr1DQXwOOmdEtRtlxQ5HsxbTkxeOkPv+eg==" }, "@ariakit/react": { - "version": "0.2.10", - "resolved": "https://registry.npmjs.org/@ariakit/react/-/react-0.2.10.tgz", - "integrity": "sha512-T0ftSgAuEXzA5MvurSWALfJBhTHzEgkXTDWEBTOkSzR5nxilPU/80UgA7dKHi4SGA3wUXIIMjRb42Djk3Qi9pQ==", + "version": "0.2.12", + "resolved": "https://registry.npmjs.org/@ariakit/react/-/react-0.2.12.tgz", + "integrity": "sha512-4rAgMyUURHW78EKgRCanhyRUtsiYCOxO65BBHF4mg3tZsDeOvu9kBG5IAXX8mUgakTcyr0EKXuOtGThaj7gobA==", "requires": { - "@ariakit/react-core": "0.2.10" + "@ariakit/react-core": "0.2.12" } }, "@ariakit/react-core": { - "version": "0.2.10", - "resolved": "https://registry.npmjs.org/@ariakit/react-core/-/react-core-0.2.10.tgz", - "integrity": "sha512-/MBX9ToIBQUR//uaOs1XzLz+Zq7ECMQmr670mXiDg3L9bu0siQKP3vD2Fl8RDRWMEMOk6+0Utr3Fm49hYlg24g==", + "version": "0.2.12", + "resolved": "https://registry.npmjs.org/@ariakit/react-core/-/react-core-0.2.12.tgz", + "integrity": "sha512-3KSKlX10nnhCvjsbPW0CAnqG+6grryfwnMkeJJ/h34FSV7hEfUMexmIjKBVZyfBG08Xj8NjSK8kkx9c3ChkXeA==", "requires": { - "@ariakit/core": "0.2.6", + "@ariakit/core": "0.2.7", "@floating-ui/dom": "^1.0.0", "use-sync-external-store": "^1.2.0" } @@ -17415,7 +17415,7 @@ "@wordpress/components": { "version": "file:packages/components", "requires": { - "@ariakit/react": "^0.2.10", + "@ariakit/react": "^0.2.12", "@babel/runtime": "^7.16.0", "@emotion/cache": "^11.7.1", "@emotion/css": "^11.7.1", @@ -18575,6 +18575,7 @@ "@wordpress/i18n": "file:packages/i18n", "@wordpress/icons": "file:packages/icons", "@wordpress/notices": "file:packages/notices", + "@wordpress/private-apis": "file:packages/private-apis", "@wordpress/url": "file:packages/url" } }, @@ -25922,7 +25923,7 @@ "array-ify": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz", - "integrity": "sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==", + "integrity": "sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4=", "dev": true }, "array-includes": { @@ -31131,7 +31132,7 @@ "debuglog": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/debuglog/-/debuglog-1.0.1.tgz", - "integrity": "sha512-syBZ+rnAK3EgMsH2aYEOLUW7mZSY9Gb+0wUMCFsZvcmiz+HigA0LOcq/HoQqVuGG+EKykunc7QG2bzrponfaSw==", + "integrity": "sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=", "dev": true }, "decache": { @@ -35972,7 +35973,7 @@ "git-remote-origin-url": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/git-remote-origin-url/-/git-remote-origin-url-2.0.0.tgz", - "integrity": "sha512-eU+GGrZgccNJcsDH5LkXR3PB9M958hxc7sbA8DFJjrv9j4L2P/eZfKhM+QD6wyzpiv+b1BpK0XrYCxkovtjSLw==", + "integrity": "sha1-UoJlna4hBxRaERJhEq0yFuxfpl8=", "dev": true, "requires": { "gitconfiglocal": "^1.0.0", @@ -36019,7 +36020,7 @@ "gitconfiglocal": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/gitconfiglocal/-/gitconfiglocal-1.0.0.tgz", - "integrity": "sha512-spLUXeTAVHxDtKsJc8FkFVgFtMdEN9qPGpL23VfSHx4fP4+Ds097IXLvymbnDH8FnmxX5Nr9bPw3A+AQ6mWEaQ==", + "integrity": "sha1-QdBF84UaXqiPA/JMocYXgRRGS5s=", "dev": true, "requires": { "ini": "^1.3.2" @@ -37267,7 +37268,7 @@ "humanize-ms": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", - "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", + "integrity": "sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0=", "dev": true, "requires": { "ms": "^2.0.0" @@ -38283,7 +38284,7 @@ "is-text-path": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-1.0.1.tgz", - "integrity": "sha512-xFuJpne9oFz5qDaodwmmG08e3CawH/2ZV8Qqza1Ko7Sk8POWbkRdwIoAWVhqvq0XeUzANEhKo2n0IXUGBm7A/w==", + "integrity": "sha1-Thqg+1G/vLPpJogAE5cgLBd1tm4=", "dev": true, "requires": { "text-extensions": "^1.0.0" @@ -40056,7 +40057,7 @@ "jsonparse": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", - "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==", + "integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=", "dev": true }, "jsprim": { @@ -41162,7 +41163,7 @@ "lodash.ismatch": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz", - "integrity": "sha512-fPMfXjGQEV9Xsq/8MTSgUf255gawYRbjwMyDbcvDhXgV7enSZA0hynz6vMPnpAb5iONEzBHBPsT+0zes5Z301g==", + "integrity": "sha1-dWy1FQyjum8RCFp4hJZF8Yj4Xzc=", "dev": true }, "lodash.isplainobject": { @@ -48665,7 +48666,7 @@ "promzard": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/promzard/-/promzard-0.3.0.tgz", - "integrity": "sha512-JZeYqd7UAcHCwI+sTOeUDYkvEU+1bQ7iE0UT1MgB/tERkAPkesW46MrpIySzODi+owTjZtiF8Ay5j9m60KmMBw==", + "integrity": "sha1-JqXW7ox97kyxIggwWs+5O6OCqe4=", "dev": true, "requires": { "read": "1" @@ -48699,7 +48700,7 @@ "proto-list": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", - "integrity": "sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==", + "integrity": "sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=", "dev": true }, "protocols": { @@ -50316,7 +50317,7 @@ "read": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", - "integrity": "sha512-rSOKNYUmaxy0om1BNjMN4ezNT6VKK+2xF4GBhc81mkH7L60i6dp8qPYrkndNLT3QPphoII3maL9PVC9XmhHwVQ==", + "integrity": "sha1-s9oZvQUkMal2cdRKQmNK33ELQMQ=", "dev": true, "requires": { "mute-stream": "~0.0.4" @@ -55706,7 +55707,7 @@ "temp-dir": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-1.0.0.tgz", - "integrity": "sha512-xZFXEGbG7SNC3itwBzI3RYjq/cEhBkx2hJuKGIUOcEULmkQExXiHat2z/qkISYsuR+IKumhEfKKbV5qXmhICFQ==", + "integrity": "sha1-CnwOom06Oa+n4OvqnB/AvE2qAR0=", "dev": true }, "terminal-link": { diff --git a/packages/block-editor/README.md b/packages/block-editor/README.md index 937bfea2f49656..2c42b42afc4424 100644 --- a/packages/block-editor/README.md +++ b/packages/block-editor/README.md @@ -680,10 +680,6 @@ _Related_ Private @wordpress/block-editor APIs. -### ReusableBlocksRenameHint - -Undocumented declaration. - ### RichText _Related_ diff --git a/packages/block-editor/src/components/block-removal-warning-modal/index.js b/packages/block-editor/src/components/block-removal-warning-modal/index.js index b2a8ededda2619..af521b7233435a 100644 --- a/packages/block-editor/src/components/block-removal-warning-modal/index.js +++ b/packages/block-editor/src/components/block-removal-warning-modal/index.js @@ -16,38 +16,26 @@ import { __ } from '@wordpress/i18n'; import { store as blockEditorStore } from '../../store'; import { unlock } from '../../lock-unlock'; -// In certain editing contexts, we'd like to prevent accidental removal of -// important blocks. For example, in the site editor, the Query Loop block is -// deemed important. In such cases, we'll ask the user for confirmation that -// they intended to remove such block(s). -// -// @see https://github.com/WordPress/gutenberg/pull/51145 -export const blockTypePromptMessages = { - 'core/query': __( 'Query Loop displays a list of posts or pages.' ), - 'core/post-content': __( - 'Post Content displays the content of a post or page.' - ), -}; - -export function BlockRemovalWarningModal() { +export function BlockRemovalWarningModal( { rules } ) { const { clientIds, selectPrevious, blockNamesForPrompt } = useSelect( ( select ) => unlock( select( blockEditorStore ) ).getRemovalPromptData() ); const { - clearRemovalPrompt, - toggleRemovalPromptSupport, + clearBlockRemovalPrompt, + setBlockRemovalRules, privateRemoveBlocks, } = unlock( useDispatch( blockEditorStore ) ); - // Signalling the removal prompt is in place. + // Load block removal rules, simultaneously signalling that the block + // removal prompt is in place. useEffect( () => { - toggleRemovalPromptSupport( true ); + setBlockRemovalRules( rules ); return () => { - toggleRemovalPromptSupport( false ); + setBlockRemovalRules(); }; - }, [ toggleRemovalPromptSupport ] ); + }, [ rules, setBlockRemovalRules ] ); if ( ! blockNamesForPrompt ) { return; @@ -55,25 +43,23 @@ export function BlockRemovalWarningModal() { const onConfirmRemoval = () => { privateRemoveBlocks( clientIds, selectPrevious, /* force */ true ); - clearRemovalPrompt(); + clearBlockRemovalPrompt(); }; return ( { blockNamesForPrompt.length === 1 ? ( -

{ blockTypePromptMessages[ blockNamesForPrompt[ 0 ] ] }

+

{ rules[ blockNamesForPrompt[ 0 ] ] }

) : (
    { blockNamesForPrompt.map( ( name ) => ( -
  • - { blockTypePromptMessages[ name ] } -
  • +
  • { rules[ name ] }
  • ) ) }
) } @@ -83,7 +69,7 @@ export function BlockRemovalWarningModal() { : __( 'Removing this block is not advised.' ) }

-