6
6
__experimentalToolsPanel as ToolsPanel ,
7
7
__experimentalToolsPanelItem as ToolsPanelItem ,
8
8
__experimentalBoxControl as BoxControl ,
9
- __experimentalUnitControl as UnitControl ,
10
9
__experimentalUseCustomUnits as useCustomUnits ,
11
10
} from '@wordpress/components' ;
12
11
import { __experimentalUseCustomSides as useCustomSides } from '@wordpress/block-editor' ;
@@ -21,9 +20,8 @@ const AXIAL_SIDES = [ 'horizontal', 'vertical' ];
21
20
export function useHasDimensionsPanel ( name ) {
22
21
const hasPadding = useHasPadding ( name ) ;
23
22
const hasMargin = useHasMargin ( name ) ;
24
- const hasGap = useHasGap ( name ) ;
25
23
26
- return hasPadding || hasMargin || hasGap ;
24
+ return hasPadding || hasMargin ;
27
25
}
28
26
29
27
function useHasPadding ( name ) {
@@ -40,13 +38,6 @@ function useHasMargin( name ) {
40
38
return settings && supports . includes ( 'margin' ) ;
41
39
}
42
40
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
-
50
41
function filterValuesBySides ( values , sides ) {
51
42
if ( ! sides ) {
52
43
// If no custom side configuration all sides are opted into by default.
@@ -88,7 +79,6 @@ function splitStyleValue( value ) {
88
79
export default function DimensionsPanel ( { name } ) {
89
80
const showPaddingControl = useHasPadding ( name ) ;
90
81
const showMarginControl = useHasMargin ( name ) ;
91
- const showGapControl = useHasGap ( name ) ;
92
82
const units = useCustomUnits ( {
93
83
availableUnits : useSetting ( 'spacing.units' , name ) [ 0 ] || [
94
84
'%' ,
@@ -128,15 +118,9 @@ export default function DimensionsPanel( { name } ) {
128
118
const resetMarginValue = ( ) => setMarginValues ( { } ) ;
129
119
const hasMarginValue = ( ) =>
130
120
! ! marginValues && Object . keys ( marginValues ) . length ;
131
-
132
- const [ gapValue , setGapValue ] = useStyle ( 'spacing.blockGap' , name ) ;
133
- const resetGapValue = ( ) => setGapValue ( undefined ) ;
134
- const hasGapValue = ( ) => ! ! gapValue ;
135
-
136
121
const resetAll = ( ) => {
137
122
resetPaddingValue ( ) ;
138
123
resetMarginValue ( ) ;
139
- resetGapValue ( ) ;
140
124
} ;
141
125
142
126
return (
@@ -177,23 +161,6 @@ export default function DimensionsPanel( { name } ) {
177
161
/>
178
162
</ ToolsPanelItem >
179
163
) }
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
- ) }
197
164
</ ToolsPanel >
198
165
) ;
199
166
}
0 commit comments