Skip to content

Commit 25573eb

Browse files
committed
fix #821
1 parent 8e578c7 commit 25573eb

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/blocks/flex/block.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,7 @@
7272
"spacing": {
7373
"margin": true,
7474
"padding": true,
75-
"blockGap": {
76-
"sides": [ "horizontal", "vertical" ],
77-
"__experimentalDefault": "0px"
78-
},
75+
"blockGap": true,
7976
"__experimentalDefaultControls": {
8077
"padding": true,
8178
"blockGap": true

src/blocks/flex/index.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,22 @@ function ( $block_content, $block, $instance ) {
2424
: null;
2525

2626
if ( is_null( $gap_value ) ) {
27-
$gap_value = isset( $block_type->supports['spacing']['blockGap']['__experimentalDefault'] )
28-
? $block_type->supports['spacing']['blockGap']['__experimentalDefault']
29-
: null;
27+
return $block_content;
3028
}
3129

32-
if ( is_null( $gap_value ) ) {
33-
return $block_content;
30+
// Dont support sides values.
31+
if ( is_array( $gap_value ) ) {
32+
if ( isset( $gap_value['top'] ) ) {
33+
$gap_value = $gap_value['top'];
34+
} else {
35+
return $block_content;
36+
}
3437
}
3538

36-
$block_gap = isset( $global_settings['spacing']['blockGap'] )
39+
$block_gap = isset( $global_settings['spacing']['blockGap'] )
3740
? $global_settings['spacing']['blockGap']
3841
: null;
42+
3943
$has_block_gap_support = isset( $block_gap );
4044
if ( ! $has_block_gap_support ) {
4145
return $block_content;

0 commit comments

Comments
 (0)