diff --git a/docs/reference-guides/data/data-core-block-editor.md b/docs/reference-guides/data/data-core-block-editor.md index bd4193182d444d..4b66ad9eb6cb40 100644 --- a/docs/reference-guides/data/data-core-block-editor.md +++ b/docs/reference-guides/data/data-core-block-editor.md @@ -81,7 +81,6 @@ _Parameters_ - _state_ `Object`: Editor state. - _clientId_ `string`: The block client Id. -- _rootClientId_ `?string`: Optional root client ID of block list. _Returns_ @@ -95,7 +94,6 @@ _Parameters_ - _state_ `Object`: Editor state. - _clientIds_ `string`: The block client IDs to be moved. -- _rootClientId_ `?string`: Optional root client ID of block list. _Returns_ diff --git a/packages/block-editor/src/store/selectors.js b/packages/block-editor/src/store/selectors.js index 6f8817b507e703..9a2764512e090a 100644 --- a/packages/block-editor/src/store/selectors.js +++ b/packages/block-editor/src/store/selectors.js @@ -1749,13 +1749,12 @@ export function canRemoveBlocks( state, clientIds ) { /** * Determines if the given block is allowed to be moved. * - * @param {Object} state Editor state. - * @param {string} clientId The block client Id. - * @param {?string} rootClientId Optional root client ID of block list. + * @param {Object} state Editor state. + * @param {string} clientId The block client Id. * * @return {boolean | undefined} Whether the given block is allowed to be moved. */ -export function canMoveBlock( state, clientId, rootClientId = null ) { +export function canMoveBlock( state, clientId ) { const attributes = getBlockAttributes( state, clientId ); if ( attributes === null ) { return true; @@ -1763,6 +1762,8 @@ export function canMoveBlock( state, clientId, rootClientId = null ) { if ( attributes.lock?.move !== undefined ) { return ! attributes.lock.move; } + + const rootClientId = getBlockRootClientId( state, clientId ); if ( getTemplateLock( state, rootClientId ) === 'all' ) { return false; } @@ -1772,16 +1773,13 @@ export function canMoveBlock( state, clientId, rootClientId = null ) { /** * Determines if the given blocks are allowed to be moved. * - * @param {Object} state Editor state. - * @param {string} clientIds The block client IDs to be moved. - * @param {?string} rootClientId Optional root client ID of block list. + * @param {Object} state Editor state. + * @param {string} clientIds The block client IDs to be moved. * * @return {boolean} Whether the given blocks are allowed to be moved. */ -export function canMoveBlocks( state, clientIds, rootClientId = null ) { - return clientIds.every( ( clientId ) => - canMoveBlock( state, clientId, rootClientId ) - ); +export function canMoveBlocks( state, clientIds ) { + return clientIds.every( ( clientId ) => canMoveBlock( state, clientId ) ); } /**