From 51b905449d9cbba3333029eb670d396933e19dae Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Thu, 29 Aug 2024 11:28:33 +0400 Subject: [PATCH] Zoom Out: Don't pass 'rootClientId' to block lock selectors (#64887) Co-authored-by: Mamaduka Co-authored-by: ellatrix --- docs/reference-guides/data/data-core-block-editor.md | 2 +- .../src/components/block-tools/zoom-out-popover.js | 9 ++------- .../src/components/block-tools/zoom-out-toolbar.js | 12 ++++-------- packages/block-editor/src/store/selectors.js | 2 +- 4 files changed, 8 insertions(+), 17 deletions(-) diff --git a/docs/reference-guides/data/data-core-block-editor.md b/docs/reference-guides/data/data-core-block-editor.md index 040a10f8f506c..c6552ef431cef 100644 --- a/docs/reference-guides/data/data-core-block-editor.md +++ b/docs/reference-guides/data/data-core-block-editor.md @@ -84,7 +84,7 @@ _Parameters_ _Returns_ -- `boolean | undefined`: Whether the given block is allowed to be moved. +- `boolean`: Whether the given block is allowed to be moved. ### canMoveBlocks diff --git a/packages/block-editor/src/components/block-tools/zoom-out-popover.js b/packages/block-editor/src/components/block-tools/zoom-out-popover.js index bb127351f09d8..a1f2990a5cc1e 100644 --- a/packages/block-editor/src/components/block-tools/zoom-out-popover.js +++ b/packages/block-editor/src/components/block-tools/zoom-out-popover.js @@ -11,12 +11,8 @@ import useSelectedBlockToolProps from './use-selected-block-tool-props'; import ZoomOutToolbar from './zoom-out-toolbar'; export default function ZoomOutPopover( { clientId, __unstableContentRef } ) { - const { - capturingClientId, - isInsertionPointVisible, - lastClientId, - rootClientId, - } = useSelectedBlockToolProps( clientId ); + const { capturingClientId, isInsertionPointVisible, lastClientId } = + useSelectedBlockToolProps( clientId ); const popoverProps = useBlockToolbarPopoverProps( { contentElement: __unstableContentRef?.current, @@ -44,7 +40,6 @@ export default function ZoomOutPopover( { clientId, __unstableContentRef } ) { ); diff --git a/packages/block-editor/src/components/block-tools/zoom-out-toolbar.js b/packages/block-editor/src/components/block-tools/zoom-out-toolbar.js index b5503c253548b..0d3df9e20dfc5 100644 --- a/packages/block-editor/src/components/block-tools/zoom-out-toolbar.js +++ b/packages/block-editor/src/components/block-tools/zoom-out-toolbar.js @@ -21,11 +21,7 @@ import BlockMover from '../block-mover'; import Shuffle from '../block-toolbar/shuffle'; import NavigableToolbar from '../navigable-toolbar'; -export default function ZoomOutToolbar( { - clientId, - rootClientId, - __unstableContentRef, -} ) { +export default function ZoomOutToolbar( { clientId, __unstableContentRef } ) { const selected = useSelect( ( select ) => { const { @@ -65,11 +61,11 @@ export default function ZoomOutToolbar( { isBlockTemplatePart, isNextBlockTemplatePart, isPrevBlockTemplatePart, - canRemove: canRemoveBlock( clientId, rootClientId ), - canMove: canMoveBlock( clientId, rootClientId ), + canRemove: canRemoveBlock( clientId ), + canMove: canMoveBlock( clientId ), }; }, - [ clientId, rootClientId ] + [ clientId ] ); const { diff --git a/packages/block-editor/src/store/selectors.js b/packages/block-editor/src/store/selectors.js index 32fa081b390ae..8d4d94bdaa98f 100644 --- a/packages/block-editor/src/store/selectors.js +++ b/packages/block-editor/src/store/selectors.js @@ -1752,7 +1752,7 @@ export function canRemoveBlocks( state, clientIds ) { * @param {Object} state Editor state. * @param {string} clientId The block client Id. * - * @return {boolean | undefined} Whether the given block is allowed to be moved. + * @return {boolean} Whether the given block is allowed to be moved. */ export function canMoveBlock( state, clientId ) { const attributes = getBlockAttributes( state, clientId );