Skip to content

Commit

Permalink
Zoom Out: Don't pass 'rootClientId' to block lock selectors (#64887)
Browse files Browse the repository at this point in the history
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: ellatrix <ellatrix@git.wordpress.org>
  • Loading branch information
3 people authored Aug 29, 2024
1 parent 47bf56a commit a9f239b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 17 deletions.
2 changes: 1 addition & 1 deletion docs/reference-guides/data/data-core-block-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -44,7 +40,6 @@ export default function ZoomOutPopover( { clientId, __unstableContentRef } ) {
<ZoomOutToolbar
__unstableContentRef={ __unstableContentRef }
clientId={ clientId }
rootClientId={ rootClientId }
/>
</BlockPopover>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down

0 comments on commit a9f239b

Please sign in to comment.