Skip to content

Commit

Permalink
Use array of features
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka committed Jul 6, 2023
1 parent 9e1a8fe commit 512aeb4
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down Expand Up @@ -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 (
<>
Expand Down

0 comments on commit 512aeb4

Please sign in to comment.