Skip to content

Commit

Permalink
Block Editor: Update conditions when the Shuffle button can be displa…
Browse files Browse the repository at this point in the history
…yed (WordPress#64888)


Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: kevin940726 <[email protected]>
  • Loading branch information
3 people authored and bph committed Aug 31, 2024
1 parent 1f8a3fd commit f8b70f2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/block-editor/src/components/block-toolbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export function PrivateBlockToolbar( {
shouldShowVisualToolbar,
showParentSelector,
isUsingBindings,
canRemove,
} = useSelect( ( select ) => {
const {
getBlockName,
Expand All @@ -75,6 +76,7 @@ export function PrivateBlockToolbar( {
getBlockRootClientId,
getBlockEditingMode,
getBlockAttributes,
canRemoveBlock,
} = select( blockEditorStore );
const selectedBlockClientIds = getSelectedBlockClientIds();
const selectedBlockClientId = selectedBlockClientIds[ 0 ];
Expand Down Expand Up @@ -115,6 +117,7 @@ export function PrivateBlockToolbar( {
selectedBlockClientIds.length === 1 &&
_isDefaultEditingMode,
isUsingBindings: _isUsingBindings,
canRemove: canRemoveBlock( selectedBlockClientId ),
};
}, [] );

Expand Down Expand Up @@ -195,7 +198,9 @@ export function PrivateBlockToolbar( {
</ToolbarGroup>
</div>
) }
<Shuffle clientId={ blockClientId } />
{ ! isMultiToolbar && canRemove && (
<Shuffle clientId={ blockClientId } />
) }
{ shouldShowVisualToolbar && isMultiToolbar && (
<BlockGroupToolbar />
) }
Expand Down

0 comments on commit f8b70f2

Please sign in to comment.