Skip to content

Commit

Permalink
Lazy evaludate block support
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka committed Nov 1, 2023
1 parent 5189570 commit fdf2f10
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions packages/block-editor/src/hooks/anchor.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,17 @@ function BlockEditAnchorControl( { blockName, attributes, setAttributes } ) {
export const withInspectorControl = createHigherOrderComponent(
( BlockEdit ) => {
return ( props ) => {
const hasAnchor = hasBlockSupport( props.name, 'anchor' );

return (
<>
<BlockEdit { ...props } />
{ hasAnchor && props.isSelected && (
<BlockEditAnchorControl
blockName={ props.name }
attributes={ props.attributes }
setAttributes={ props.setAttributes }
/>
) }
{ props.isSelected &&
hasBlockSupport( props.name, 'anchor' ) && (
<BlockEditAnchorControl
blockName={ props.name }
attributes={ props.attributes }
setAttributes={ props.setAttributes }
/>
) }
</>
);
};
Expand Down

0 comments on commit fdf2f10

Please sign in to comment.