Skip to content

Commit

Permalink
Template Parts: Disable block transformations (#42090)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka authored Jul 1, 2022
1 parent 10594b1 commit ff68d80
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/block-editor/src/components/block-switcher/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,14 @@ export const BlockSwitcherDropdownMenu = ( { clientIds, blocks } ) => {
// Pattern transformation through the `Patterns` API.
const onPatternTransform = ( transformedBlocks ) =>
replaceBlocks( clientIds, transformedBlocks );

/**
* The `isTemplate` check is a stopgap solution here.
* Ideally, the Transforms API should handle this
* by allowing to exclude blocks from wildcard transformations.
*/
const hasPossibleBlockTransformations =
!! possibleBlockTransformations.length && canRemove;
!! possibleBlockTransformations.length && canRemove && ! isTemplate;
const hasPatternTransformation = !! patterns?.length && canRemove;
if ( ! hasBlockStyles && ! hasPossibleBlockTransformations ) {
return (
Expand Down

0 comments on commit ff68d80

Please sign in to comment.