Skip to content

Commit

Permalink
Padding Edit: Fix handling of custom unit theme setting (#28603)
Browse files Browse the repository at this point in the history
  • Loading branch information
Q committed Feb 3, 2021
1 parent ac5968b commit 92baa9b
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions packages/block-editor/src/hooks/padding.js
Expand Up @@ -10,7 +10,7 @@ import { __experimentalBoxControl as BoxControl } from '@wordpress/components';
* Internal dependencies
*/
import { cleanEmptyObject } from './utils';
import useEditorFeature from '../components/use-editor-feature';
import { useCustomUnits } from '../components/unit-control';

export const SPACING_SUPPORT_KEY = 'spacing';

Expand All @@ -20,11 +20,11 @@ const hasPaddingSupport = ( blockName ) => {
};

/**
* Inspector control panel containing the line height related configuration
* Inspector control panel containing the padding related configuration
*
* @param {Object} props
*
* @return {WPElement} Line height edit element.
* @return {WPElement} Padding edit element.
*/
export function PaddingEdit( props ) {
const {
Expand All @@ -33,11 +33,7 @@ export function PaddingEdit( props ) {
setAttributes,
} = props;

const customUnits = useEditorFeature( 'spacing.units' );
const units = customUnits?.map( ( unit ) => ( {
value: unit,
label: unit,
} ) );
const units = useCustomUnits();

if ( ! hasPaddingSupport( blockName ) ) {
return null;
Expand Down

0 comments on commit 92baa9b

Please sign in to comment.