Skip to content

Commit

Permalink
Add fallback gap styles rendered at root
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewserong committed May 13, 2022
1 parent b2bc04a commit 896c46e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/compat/wordpress-6.0/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,13 @@ protected function get_block_classes( $style_nodes ) {
if ( $has_block_gap_support ) {
$block_rules .= '.wp-site-blocks > * { margin-block-start: 0; margin-block-end: 0; }';
$block_rules .= '.wp-site-blocks > * + * { margin-block-start: var( --wp--style--block-gap ); }';

$block_gap_value = _wp_array_get( $node, array( 'spacing', 'blockGap' ), '0.5em' );
foreach( static::LAYOUT_STYLES as $key => $layout_style_selectors ) {
foreach( $layout_style_selectors as $layout_selector => $css_property ) {
$block_rules .= "$selector $layout_selector { " . $css_property . ': ' . $block_gap_value . " }";
}
}
}
}
}
Expand Down

0 comments on commit 896c46e

Please sign in to comment.