diff --git a/package-lock.json b/package-lock.json index 3c39cac1f8dce..c1c23cff497d5 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 937bfea2f4965..2c42b42afc442 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 b2a8ededda261..af521b7233435 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 ] ] }

) : ( ) } @@ -83,7 +69,7 @@ export function BlockRemovalWarningModal() { : __( 'Removing this block is not advised.' ) }

-