Skip to content

Commit

Permalink
Avoid BlockControls mount for all blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Jan 19, 2024
1 parent b78d187 commit 0273411
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/edit-site/src/hooks/template-part-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,16 @@ export const withEditBlockControls = createHigherOrderComponent(
const { attributes, name } = props;
const isDisplayed = name === 'core/template-part' && attributes.slug;

if ( ! isDisplayed ) {
return <BlockEdit { ...props } />;
}

return (
<>
<BlockEdit { ...props } />
{ isDisplayed && (
<BlockControls group="other">
<EditTemplatePartMenuItem attributes={ attributes } />
</BlockControls>
) }
<BlockControls group="other">
<EditTemplatePartMenuItem attributes={ attributes } />
</BlockControls>
</>
);
},
Expand Down

0 comments on commit 0273411

Please sign in to comment.