Skip to content

Commit

Permalink
add consition to remove core patterns from shuffle
Browse files Browse the repository at this point in the history
  • Loading branch information
MaggieCabrera committed Jun 19, 2024
1 parent a1f7c07 commit b23b1fe
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/block-editor/src/components/block-toolbar/shuffle.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,17 @@ export default function Shuffle( { clientId, as = Container } ) {
return EMPTY_ARRAY;
}
return patterns.filter( ( pattern ) => {
const isCorePattern =
pattern.source === 'core' ||
( pattern.source !== 'pattern-directory/theme' &&
pattern.source?.startsWith( 'pattern-directory' ) ===
true );
return (
// Check if the pattern has only one top level block,
// otherwise we may shuffle to pattern that will not allow to continue shuffling.
pattern.blocks.length === 1 &&
// We exclude the pattern directory and core patterns that are not theme patterns.
! isCorePattern &&
pattern.categories?.some( ( category ) => {
return categories.includes( category );
} ) &&
Expand Down

0 comments on commit b23b1fe

Please sign in to comment.