Skip to content

Commit

Permalink
BlockSettingsMenuControls: Fix 'showLockButton' check (#41788)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka authored Jun 20, 2022
1 parent f6498da commit a265d13
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
useConvertToGroupButtonProps,
ConvertToGroupButton,
} from '../convert-to-group-buttons';
import { BlockLockMenuItem } from '../block-lock';
import { BlockLockMenuItem, useBlockLock } from '../block-lock';
import { store as blockEditorStore } from '../../store';

const { Fill, Slot } = createSlotFill( 'BlockSettingsMenuControls' );
Expand All @@ -47,7 +47,8 @@ const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {
[ clientIds ]
);

const showLockButton = selectedClientIds.length === 1;
const { canLock } = useBlockLock( selectedClientIds[ 0 ] );
const showLockButton = selectedClientIds.length === 1 && canLock;

// Check if current selection of blocks is Groupable or Ungroupable
// and pass this props down to ConvertToGroupButton.
Expand Down

0 comments on commit a265d13

Please sign in to comment.