From be69596cc9f379e546f4b93932a06a7904f93191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ella=20van=C2=A0Durpe?= Date: Fri, 24 Feb 2023 17:52:36 +0200 Subject: [PATCH] Layout hook: improve BlockEdit filter --- packages/block-editor/src/hooks/layout.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/packages/block-editor/src/hooks/layout.js b/packages/block-editor/src/hooks/layout.js index 836a9cd5a57c6e..252f7de86714f0 100644 --- a/packages/block-editor/src/hooks/layout.js +++ b/packages/block-editor/src/hooks/layout.js @@ -326,18 +326,14 @@ export function addAttribute( settings ) { * @return {Function} Wrapped component. */ export const withInspectorControls = createHigherOrderComponent( - ( BlockEdit ) => ( props ) => { - const { name: blockName } = props; - const supportLayout = hasBlockSupport( - blockName, - layoutBlockSupportKey - ); - - return [ - supportLayout && , + ( BlockEdit ) => ( props ) => + [ + props.isSelected && + hasBlockSupport( props.name, layoutBlockSupportKey ) && ( + + ), , - ]; - }, + ], 'withInspectorControls' );