diff --git a/packages/edit-site/src/hooks/push-changes-to-global-styles/index.js b/packages/edit-site/src/hooks/push-changes-to-global-styles/index.js index 0407b85c4e8bcd..4844ec6d03eb5e 100644 --- a/packages/edit-site/src/hooks/push-changes-to-global-styles/index.js +++ b/packages/edit-site/src/hooks/push-changes-to-global-styles/index.js @@ -389,30 +389,36 @@ function PushChangesToGlobalStylesControl( { ); } -const withPushChangesToGlobalStyles = createHigherOrderComponent( - ( BlockEdit ) => ( props ) => { - const blockEditingMode = useBlockEditingMode(); - const isBlockBasedTheme = useSelect( - ( select ) => select( coreStore ).getCurrentTheme()?.is_block_theme, - [] - ); - const supportsStyles = SUPPORTED_STYLES.some( ( feature ) => - hasBlockSupport( props.name, feature ) - ); - - return ( - <> - - { blockEditingMode === 'default' && - supportsStyles && - isBlockBasedTheme && ( - - - - ) } - - ); +function PushChangesToGlobalStyles( props ) { + const blockEditingMode = useBlockEditingMode(); + const isBlockBasedTheme = useSelect( + ( select ) => select( coreStore ).getCurrentTheme()?.is_block_theme, + [] + ); + const supportsStyles = SUPPORTED_STYLES.some( ( feature ) => + hasBlockSupport( props.name, feature ) + ); + const isDisplayed = + blockEditingMode === 'default' && supportsStyles && isBlockBasedTheme; + + if ( ! isDisplayed ) { + return null; } + + return ( + + + + ); +} + +const withPushChangesToGlobalStyles = createHigherOrderComponent( + ( BlockEdit ) => ( props ) => ( + <> + + { props.isSelected && } + + ) ); addFilter(