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 authored and noisysocks committed Feb 7, 2021
1 parent fb0e10d commit 48f7d46
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions packages/block-editor/src/hooks/padding.js
Original file line number Diff line number Diff line change
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 48f7d46

Please sign in to comment.