From 512aeb4dcadac87d75008abff8846238536eabf3 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Thu, 6 Jul 2023 10:10:38 +0400 Subject: [PATCH] Use array of features --- .../src/hooks/push-changes-to-global-styles/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 d3bd3c083f7d77..9b4730a7bb1fc4 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 @@ -94,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 ); @@ -213,9 +215,9 @@ function PushChangesToGlobalStylesControl( { const withPushChangesToGlobalStyles = createHigherOrderComponent( ( BlockEdit ) => ( props ) => { const blockEditingMode = useBlockEditingMode(); - const supportsStyles = - hasBlockSupport( props.name, 'color' ) || - hasBlockSupport( props.name, 'typography' ); + const supportsStyles = SUPPORTED_STYLES.some( ( feature ) => + hasBlockSupport( props.name, feature ) + ); return ( <>