Skip to content

Commit

Permalink
Simplify condition
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonjd committed Sep 2, 2024
1 parent 7c9aed4 commit 1f1ed94
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/block-editor/src/components/block-switcher/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@ export const BlockSwitcher = ( { clientIds, disabled, isUsingBindings } ) => {
} else {
const isSelectionOfSameType =
new Set( _blocks.map( ( { name } ) => name ) ).size === 1;
_hasTemplateLock = clientIds.some(
( id ) => getTemplateLock( id ) === 'contentOnly'
);
// When selection consists of blocks of multiple types, display an
// appropriate icon to communicate the non-uniformity.
_icon = isSelectionOfSameType ? blockType.icon : copy;
Expand Down
3 changes: 3 additions & 0 deletions packages/block-editor/src/components/block-toolbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export function PrivateBlockToolbar( {
getBlockEditingMode,
getBlockAttributes,
canRemoveBlock,
getTemplateLock,
} = select( blockEditorStore );
const selectedBlockClientIds = getSelectedBlockClientIds();
const selectedBlockClientId = selectedBlockClientIds[ 0 ];
Expand All @@ -99,6 +100,8 @@ export function PrivateBlockToolbar( {
( clientId ) =>
!! getBlockAttributes( clientId )?.metadata?.bindings
);
// @TODO If a selected block is locked, we should not show the BlockGroupToolbar.

return {
blockClientId: selectedBlockClientId,
blockClientIds: selectedBlockClientIds,
Expand Down

0 comments on commit 1f1ed94

Please sign in to comment.