From acde3d408f67f040d3be2523b51e002a3240b415 Mon Sep 17 00:00:00 2001 From: Ben Dwyer Date: Fri, 11 Feb 2022 14:36:59 +0000 Subject: [PATCH] Update block gap approach --- src/wp-includes/class-wp-theme-json.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php index 6f7d4ee356bed..0d98f9fa9b4c1 100644 --- a/src/wp-includes/class-wp-theme-json.php +++ b/src/wp-includes/class-wp-theme-json.php @@ -198,7 +198,7 @@ class WP_Theme_JSON { 'padding-right' => array( 'spacing', 'padding', 'right' ), 'padding-bottom' => array( 'spacing', 'padding', 'bottom' ), 'padding-left' => array( 'spacing', 'padding', 'left' ), - '--wp--style--block-gap' => array( 'spacing', 'blockGap' ), + 'gap' => array( 'spacing', 'blockGap' ), 'text-decoration' => array( 'typography', 'textDecoration' ), 'text-transform' => array( 'typography', 'textTransform' ), 'filter' => array( 'filter', 'duotone' ), @@ -317,7 +317,7 @@ class WP_Theme_JSON { 'spacing' => array( 'margin' => null, 'padding' => null, - 'blockGap' => 'top', + 'blockGap' => null, ), 'typography' => array( 'fontFamily' => null, @@ -826,6 +826,7 @@ private function get_block_classes( $style_nodes ) { $has_block_gap_support = _wp_array_get( $this->theme_json, array( 'settings', 'spacing', 'blockGap' ) ) !== null; if ( $has_block_gap_support ) { + $block_rules .= 'body { --wp--style--block-gap: ' . _wp_array_get( $this->theme_json, array( 'styles', 'spacing', 'blockGap' ) ) . ';}'; $block_rules .= '.wp-site-blocks > * { margin-top: 0; margin-bottom: 0; }'; $block_rules .= '.wp-site-blocks > * + * { margin-top: var( --wp--style--block-gap ); }'; }