Skip to content

Commit

Permalink
Patterns: Check we are not within a pattern instance before running b…
Browse files Browse the repository at this point in the history
…lock deletion rules (#59044)

* Check we are not within a pattern instance before running block deletion rules on overridden blocks

* Make comment more explanatory

Co-authored-by: glendaviesnz <glendaviesnz@git.wordpress.org>
Co-authored-by: talldan <talldanwp@git.wordpress.org>
  • Loading branch information
3 people authored and getdave committed Feb 20, 2024
1 parent de9eb98 commit 3f62ea1
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'
);
// We only need to run this check when editing the original pattern, not pattern instances.
if ( parentPatternBlocks?.length > 0 ) {
continue;
}
const blockAttributes =
select.getBlockAttributes( clientId );
if (
Expand Down

0 comments on commit 3f62ea1

Please sign in to comment.