Skip to content

Commit

Permalink
Check we are not within a pattern instance before running block delet…
Browse files Browse the repository at this point in the history
…ion rules on overridden blocks
  • Loading branch information
glendaviesnz committed Feb 14, 2024
1 parent 0a82d9f commit 114537b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/block-editor/src/store/private-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,15 @@ export const privateRemoveBlocks =
}

if ( rules[ 'bindings/core/pattern-overrides' ] ) {
const parentPatternBlocks =
select.getBlockParentsByBlockName(
clientId,
'core/block'
);
// If the overriden block is a child of a core/block, skip it.
if ( parentPatternBlocks?.length > 0 ) {
continue;
}
const blockAttributes =
select.getBlockAttributes( clientId );
if (
Expand Down

0 comments on commit 114537b

Please sign in to comment.