Skip to content

Commit dcad2b4

Browse files
authored
Removing block gap control for global styles since: (#39601)
1. It's not supported at the root level in ROOT_BLOCK_SUPPORTS 2. It doesn't work at the individual block level in global styles
1 parent b243dc9 commit dcad2b4

File tree

1 file changed

+1
-34
lines changed

1 file changed

+1
-34
lines changed

packages/edit-site/src/components/global-styles/dimensions-panel.js

+1-34
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
__experimentalToolsPanel as ToolsPanel,
77
__experimentalToolsPanelItem as ToolsPanelItem,
88
__experimentalBoxControl as BoxControl,
9-
__experimentalUnitControl as UnitControl,
109
__experimentalUseCustomUnits as useCustomUnits,
1110
} from '@wordpress/components';
1211
import { __experimentalUseCustomSides as useCustomSides } from '@wordpress/block-editor';
@@ -21,9 +20,8 @@ const AXIAL_SIDES = [ 'horizontal', 'vertical' ];
2120
export function useHasDimensionsPanel( name ) {
2221
const hasPadding = useHasPadding( name );
2322
const hasMargin = useHasMargin( name );
24-
const hasGap = useHasGap( name );
2523

26-
return hasPadding || hasMargin || hasGap;
24+
return hasPadding || hasMargin;
2725
}
2826

2927
function useHasPadding( name ) {
@@ -40,13 +38,6 @@ function useHasMargin( name ) {
4038
return settings && supports.includes( 'margin' );
4139
}
4240

43-
function useHasGap( name ) {
44-
const supports = getSupportedGlobalStylesPanels( name );
45-
const [ settings ] = useSetting( 'spacing.blockGap', name );
46-
47-
return settings && supports.includes( '--wp--style--block-gap' );
48-
}
49-
5041
function filterValuesBySides( values, sides ) {
5142
if ( ! sides ) {
5243
// If no custom side configuration all sides are opted into by default.
@@ -88,7 +79,6 @@ function splitStyleValue( value ) {
8879
export default function DimensionsPanel( { name } ) {
8980
const showPaddingControl = useHasPadding( name );
9081
const showMarginControl = useHasMargin( name );
91-
const showGapControl = useHasGap( name );
9282
const units = useCustomUnits( {
9383
availableUnits: useSetting( 'spacing.units', name )[ 0 ] || [
9484
'%',
@@ -128,15 +118,9 @@ export default function DimensionsPanel( { name } ) {
128118
const resetMarginValue = () => setMarginValues( {} );
129119
const hasMarginValue = () =>
130120
!! marginValues && Object.keys( marginValues ).length;
131-
132-
const [ gapValue, setGapValue ] = useStyle( 'spacing.blockGap', name );
133-
const resetGapValue = () => setGapValue( undefined );
134-
const hasGapValue = () => !! gapValue;
135-
136121
const resetAll = () => {
137122
resetPaddingValue();
138123
resetMarginValue();
139-
resetGapValue();
140124
};
141125

142126
return (
@@ -177,23 +161,6 @@ export default function DimensionsPanel( { name } ) {
177161
/>
178162
</ToolsPanelItem>
179163
) }
180-
{ showGapControl && (
181-
<ToolsPanelItem
182-
hasValue={ hasGapValue }
183-
label={ __( 'Block spacing' ) }
184-
onDeselect={ resetGapValue }
185-
isShownByDefault={ true }
186-
>
187-
<UnitControl
188-
label={ __( 'Block spacing' ) }
189-
__unstableInputWidth="80px"
190-
min={ 0 }
191-
onChange={ setGapValue }
192-
units={ units }
193-
value={ gapValue }
194-
/>
195-
</ToolsPanelItem>
196-
) }
197164
</ToolsPanel>
198165
);
199166
}

0 commit comments

Comments
 (0)