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 ab2487e76f191..4e7b671a0c260 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 @@ -18,6 +18,7 @@ import { __, sprintf } from '@wordpress/i18n'; import { __EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY, getBlockType, + hasBlockSupport, } from '@wordpress/blocks'; import { useContext, useMemo, useCallback } from '@wordpress/element'; import { useDispatch } from '@wordpress/data'; @@ -93,6 +94,8 @@ const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = { 'typography.fontFamily': 'fontFamily', }; +const SUPPORTED_STYLES = [ 'border', 'color', 'spacing', 'typography' ]; + function useChangesToPush( name, attributes ) { const supports = useSupportedStyles( name ); @@ -256,10 +259,14 @@ function PushChangesToGlobalStylesControl( { const withPushChangesToGlobalStyles = createHigherOrderComponent( ( BlockEdit ) => ( props ) => { const blockEditingMode = useBlockEditingMode(); + const supportsStyles = SUPPORTED_STYLES.some( ( feature ) => + hasBlockSupport( props.name, feature ) + ); + return ( <> - { blockEditingMode === 'default' && ( + { blockEditingMode === 'default' && supportsStyles && (