Skip to content

Commit

Permalink
Use hasPaddingSupport from padding hook
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw committed Apr 20, 2021
1 parent d6b6bb3 commit 99995d3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/block-editor/src/hooks/padding.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import { useCustomUnits } from '../components/unit-control';
* @param {string|Object} blockType Block name or Block Type object.
* @return {boolean} Whether there is support.
*/
const hasPaddingSupport = ( blockType ) => {
export function hasPaddingSupport( blockType ) {
const support = getBlockSupport( blockType, SPACING_SUPPORT_KEY );
return !! ( true === support || support?.padding );
};
}

/**
* Custom hook that checks if padding settings have been disabled.
Expand Down
10 changes: 6 additions & 4 deletions packages/block-editor/src/hooks/spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ import { Platform } from '@wordpress/element';
/**
* Internal dependencies
*/
import { PaddingEdit, useIsPaddingDisabled } from './padding';
import {
PaddingEdit,
hasPaddingSupport,
useIsPaddingDisabled,
} from './padding';
import SpacingPanelControl from '../components/spacing-panel-control';

export const SPACING_SUPPORT_KEY = 'spacing';
Expand Down Expand Up @@ -44,9 +48,7 @@ export function hasSpacingSupport( blockName ) {
return false;
}

const support = getBlockSupport( blockName, SPACING_SUPPORT_KEY );

return !! ( true === support || support?.padding );
return hasPaddingSupport( blockName );
}

/**
Expand Down

0 comments on commit 99995d3

Please sign in to comment.