Skip to content

Commit

Permalink
Blocks within sections shouldn't be removable
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Sep 18, 2024
1 parent 96642a6 commit f1954d3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/block-editor/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
getTemporarilyEditingFocusModeToRevert,
getSectionRootClientId,
isSectionBlock,
getParentSectionBlock,
} from './private-selectors';

/**
Expand Down Expand Up @@ -1739,6 +1740,11 @@ export function canRemoveBlock( state, clientId ) {
return false;
}

const isBlockWithinSection = !! getParentSectionBlock( state, clientId );
if ( isBlockWithinSection ) {
return false;
}

return getBlockEditingMode( state, rootClientId ) !== 'disabled';
}

Expand Down

0 comments on commit f1954d3

Please sign in to comment.