From 98084f409ba93922da5a7c26149f2c52a68f4767 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Mon, 25 Oct 2021 11:04:29 +0100 Subject: [PATCH 1/6] Add outer padding support to the flow layout --- lib/block-supports/layout.php | 18 +++++++++++++----- .../class-wp-theme-json-gutenberg.php | 5 +++-- packages/block-editor/src/layouts/flow.js | 9 ++++++++- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/lib/block-supports/layout.php b/lib/block-supports/layout.php index e522390184a6d..ab86c5eb605cc 100644 --- a/lib/block-supports/layout.php +++ b/lib/block-supports/layout.php @@ -39,8 +39,9 @@ function gutenberg_get_layout_style( $selector, $layout, $has_block_gap_support $style = ''; if ( 'default' === $layout_type ) { - $content_size = isset( $layout['contentSize'] ) ? $layout['contentSize'] : null; - $wide_size = isset( $layout['wideSize'] ) ? $layout['wideSize'] : null; + $content_size = isset( $layout['contentSize'] ) ? $layout['contentSize'] : null; + $wide_size = isset( $layout['wideSize'] ) ? $layout['wideSize'] : null; + $outer_padding = isset( $layout['outerPadding'] ) ? $layout['outerPadding'] : 0; $all_max_width_value = $content_size ? $content_size : $wide_size; $wide_max_width_value = $wide_size ? $wide_size : $content_size; @@ -52,14 +53,21 @@ function gutenberg_get_layout_style( $selector, $layout, $has_block_gap_support $style = ''; if ( $content_size || $wide_size ) { - $style = "$selector > * {"; + $style = "$selector {"; + $style .= "--wp-style-layout-outer-padding: $outer_padding;"; + $style .= 'padding: 0 var(--wp-style-layout-outer-padding);'; + $style .= '}'; + $style .= "$selector > * {"; $style .= 'max-width: ' . esc_html( $all_max_width_value ) . ';'; $style .= 'margin-left: auto !important;'; $style .= 'margin-right: auto !important;'; $style .= '}'; - $style .= "$selector > .alignwide { max-width: " . esc_html( $wide_max_width_value ) . ';}'; - $style .= "$selector .alignfull { max-width: none; }"; + $style .= "$selector .alignfull {"; + $style .= 'max-width: none;'; + $style .= 'margin-left: calc( -1 * var(--wp-style-layout-outer-padding) ) !important;'; + $style .= 'margin-right: calc( -1 * var(--wp-style-layout-outer-padding) ) !important;'; + $style .= '}'; } $style .= "$selector .alignleft { float: left; margin-right: 2em; }"; diff --git a/lib/compat/wordpress-5.9/class-wp-theme-json-gutenberg.php b/lib/compat/wordpress-5.9/class-wp-theme-json-gutenberg.php index 7dd2c94bf3088..7d7b8dd165f3f 100644 --- a/lib/compat/wordpress-5.9/class-wp-theme-json-gutenberg.php +++ b/lib/compat/wordpress-5.9/class-wp-theme-json-gutenberg.php @@ -234,8 +234,9 @@ class WP_Theme_JSON_Gutenberg { ), 'custom' => null, 'layout' => array( - 'contentSize' => null, - 'wideSize' => null, + 'contentSize' => null, + 'wideSize' => null, + 'outerPadding' => null, ), 'spacing' => array( 'blockGap' => null, diff --git a/packages/block-editor/src/layouts/flow.js b/packages/block-editor/src/layouts/flow.js index fd83cf822c3e9..338e2d095f9a2 100644 --- a/packages/block-editor/src/layouts/flow.js +++ b/packages/block-editor/src/layouts/flow.js @@ -106,13 +106,18 @@ export default { return null; }, save: function DefaultLayoutStyle( { selector, layout = {} } ) { - const { contentSize, wideSize } = layout; + const { contentSize, wideSize, outerPadding = 0 } = layout; const blockGapSupport = useSetting( 'spacing.blockGap' ); const hasBlockGapStylesSupport = blockGapSupport !== null; let style = !! contentSize || !! wideSize ? ` + ${ appendSelectors( selector ) } { + --wp-style-layout-outer-padding: ${ outerPadding }; + padding: 0 var(--wp-style-layout-outer-padding); + } + ${ appendSelectors( selector, '> *' ) } { max-width: ${ contentSize ?? wideSize }; margin-left: auto !important; @@ -125,6 +130,8 @@ export default { ${ appendSelectors( selector, '> [data-align="full"]' ) } { max-width: none; + margin-left: calc( -1 * var(--wp-style-layout-outer-padding) ) !important; + margin-right: calc( -1 * var(--wp-style-layout-outer-padding) ) !important; } ` : ''; From dea6513e0a023eddf92bb4172d46a2a1654b1368 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Mon, 25 Oct 2021 11:53:52 +0100 Subject: [PATCH 2/6] Remove useless cover width --- packages/block-library/src/cover/style.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/block-library/src/cover/style.scss b/packages/block-library/src/cover/style.scss index 4b4909ad0c304..15af5159f62b7 100644 --- a/packages/block-library/src/cover/style.scss +++ b/packages/block-library/src/cover/style.scss @@ -4,7 +4,6 @@ background-size: cover; background-position: center center; min-height: 430px; - width: 100%; display: flex; justify-content: center; align-items: center; From f37d8b67636e3a3dd640f64a7f01cbbb0332a6a5 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Tue, 26 Oct 2021 09:22:35 +0100 Subject: [PATCH 3/6] Update the format of the outer padding --- lib/block-supports/layout.php | 15 ++++++++++----- packages/block-editor/src/layouts/flow.js | 11 ++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/lib/block-supports/layout.php b/lib/block-supports/layout.php index ab86c5eb605cc..8f8d13a89aa3e 100644 --- a/lib/block-supports/layout.php +++ b/lib/block-supports/layout.php @@ -41,7 +41,7 @@ function gutenberg_get_layout_style( $selector, $layout, $has_block_gap_support if ( 'default' === $layout_type ) { $content_size = isset( $layout['contentSize'] ) ? $layout['contentSize'] : null; $wide_size = isset( $layout['wideSize'] ) ? $layout['wideSize'] : null; - $outer_padding = isset( $layout['outerPadding'] ) ? $layout['outerPadding'] : 0; + $outer_padding = isset( $layout['outerPadding'] ) ? $layout['outerPadding'] : array(); $all_max_width_value = $content_size ? $content_size : $wide_size; $wide_max_width_value = $wide_size ? $wide_size : $content_size; @@ -54,8 +54,13 @@ function gutenberg_get_layout_style( $selector, $layout, $has_block_gap_support $style = ''; if ( $content_size || $wide_size ) { $style = "$selector {"; - $style .= "--wp-style-layout-outer-padding: $outer_padding;"; - $style .= 'padding: 0 var(--wp-style-layout-outer-padding);'; + $style .= sprintf( + 'padding: %s %s %s %s', + isset( $outer_padding['top'] ) ? $outer_padding['top'] : 0, + isset( $outer_padding['right'] ) ? $outer_padding['right'] : 0, + isset( $outer_padding['bottom'] ) ? $outer_padding['bottom'] : 0, + isset( $outer_padding['left'] ) ? $outer_padding['left'] : 0 + ); $style .= '}'; $style .= "$selector > * {"; $style .= 'max-width: ' . esc_html( $all_max_width_value ) . ';'; @@ -65,8 +70,8 @@ function gutenberg_get_layout_style( $selector, $layout, $has_block_gap_support $style .= "$selector > .alignwide { max-width: " . esc_html( $wide_max_width_value ) . ';}'; $style .= "$selector .alignfull {"; $style .= 'max-width: none;'; - $style .= 'margin-left: calc( -1 * var(--wp-style-layout-outer-padding) ) !important;'; - $style .= 'margin-right: calc( -1 * var(--wp-style-layout-outer-padding) ) !important;'; + $style .= isset( $outer_padding['left'] ) ? sprintf( 'margin-left: calc( -1 * %s ) !important;', $outer_padding['left'] ) : ''; + $style .= isset( $outer_padding['right'] ) ? sprintf( 'margin-right: calc( -1 * %s ) !important;', $outer_padding['right'] ) : ''; $style .= '}'; } diff --git a/packages/block-editor/src/layouts/flow.js b/packages/block-editor/src/layouts/flow.js index 338e2d095f9a2..9408e73f6fed6 100644 --- a/packages/block-editor/src/layouts/flow.js +++ b/packages/block-editor/src/layouts/flow.js @@ -106,7 +106,7 @@ export default { return null; }, save: function DefaultLayoutStyle( { selector, layout = {} } ) { - const { contentSize, wideSize, outerPadding = 0 } = layout; + const { contentSize, wideSize, outerPadding } = layout; const blockGapSupport = useSetting( 'spacing.blockGap' ); const hasBlockGapStylesSupport = blockGapSupport !== null; @@ -114,8 +114,9 @@ export default { !! contentSize || !! wideSize ? ` ${ appendSelectors( selector ) } { - --wp-style-layout-outer-padding: ${ outerPadding }; - padding: 0 var(--wp-style-layout-outer-padding); + padding: ${ outerPadding?.top || 0 } ${ outerPadding?.right || 0 } ${ + outerPadding?.bottom || 0 + } ${ outerPadding?.left || 0 }; } ${ appendSelectors( selector, '> *' ) } { @@ -130,8 +131,8 @@ export default { ${ appendSelectors( selector, '> [data-align="full"]' ) } { max-width: none; - margin-left: calc( -1 * var(--wp-style-layout-outer-padding) ) !important; - margin-right: calc( -1 * var(--wp-style-layout-outer-padding) ) !important; + margin-left: calc( -1 * ${ outerPadding.left || 0 } ) !important; + margin-right: calc( -1 * ${ outerPadding.right || 0 } ) !important; } ` : ''; From d3cf4e3c4e99d0c179794b57c33902d2788a15c6 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Thu, 4 Nov 2021 15:34:15 +0100 Subject: [PATCH 4/6] Alternative approach to the layout outer padding --- lib/block-supports/layout.php | 34 ++++++------ .../class-wp-theme-json-gutenberg.php | 6 +-- packages/block-editor/src/hooks/layout.js | 53 +++++++++++-------- packages/block-editor/src/hooks/padding.js | 13 ++++- packages/block-editor/src/layouts/flow.js | 16 +++--- .../src/components/visual-editor/index.js | 9 ++++ 6 files changed, 83 insertions(+), 48 deletions(-) diff --git a/lib/block-supports/layout.php b/lib/block-supports/layout.php index 8f8d13a89aa3e..df712681ef714 100644 --- a/lib/block-supports/layout.php +++ b/lib/block-supports/layout.php @@ -28,20 +28,20 @@ function gutenberg_register_layout_support( $block_type ) { /** * Generates the CSS corresponding to the provided layout. * - * @param string $selector CSS selector. - * @param array $layout Layout object. The one that is passed has already checked the existance of default block layout. - * @param boolean $has_block_gap_support Whether the theme has support for the block gap. + * @param string $selector CSS selector. + * @param array $layout Layout object. The one that is passed has already checked the existance of default block layout. + * @param array|null $padding Padding applied to the current block. + * @param boolean $has_block_gap_support Whether the theme has support for the block gap. * * @return string CSS style. */ -function gutenberg_get_layout_style( $selector, $layout, $has_block_gap_support = false ) { +function gutenberg_get_layout_style( $selector, $layout, $padding, $has_block_gap_support = false ) { $layout_type = isset( $layout['type'] ) ? $layout['type'] : 'default'; $style = ''; if ( 'default' === $layout_type ) { - $content_size = isset( $layout['contentSize'] ) ? $layout['contentSize'] : null; - $wide_size = isset( $layout['wideSize'] ) ? $layout['wideSize'] : null; - $outer_padding = isset( $layout['outerPadding'] ) ? $layout['outerPadding'] : array(); + $content_size = isset( $layout['contentSize'] ) ? $layout['contentSize'] : null; + $wide_size = isset( $layout['wideSize'] ) ? $layout['wideSize'] : null; $all_max_width_value = $content_size ? $content_size : $wide_size; $wide_max_width_value = $wide_size ? $wide_size : $content_size; @@ -54,12 +54,14 @@ function gutenberg_get_layout_style( $selector, $layout, $has_block_gap_support $style = ''; if ( $content_size || $wide_size ) { $style = "$selector {"; + // Using important here to override the inline padding that could be potentially + // applied using the custom padding control before the layout inheritance is applied. $style .= sprintf( - 'padding: %s %s %s %s', - isset( $outer_padding['top'] ) ? $outer_padding['top'] : 0, - isset( $outer_padding['right'] ) ? $outer_padding['right'] : 0, - isset( $outer_padding['bottom'] ) ? $outer_padding['bottom'] : 0, - isset( $outer_padding['left'] ) ? $outer_padding['left'] : 0 + 'padding: %s %s %s %s !important', + isset( $padding['top'] ) ? $padding['top'] : 0, + isset( $padding['right'] ) ? $padding['right'] : 0, + isset( $padding['bottom'] ) ? $padding['bottom'] : 0, + isset( $padding['left'] ) ? $padding['left'] : 0 ); $style .= '}'; $style .= "$selector > * {"; @@ -70,8 +72,8 @@ function gutenberg_get_layout_style( $selector, $layout, $has_block_gap_support $style .= "$selector > .alignwide { max-width: " . esc_html( $wide_max_width_value ) . ';}'; $style .= "$selector .alignfull {"; $style .= 'max-width: none;'; - $style .= isset( $outer_padding['left'] ) ? sprintf( 'margin-left: calc( -1 * %s ) !important;', $outer_padding['left'] ) : ''; - $style .= isset( $outer_padding['right'] ) ? sprintf( 'margin-right: calc( -1 * %s ) !important;', $outer_padding['right'] ) : ''; + $style .= isset( $padding['left'] ) ? sprintf( 'margin-left: calc( -1 * %s ) !important;', $padding['left'] ) : ''; + $style .= isset( $padding['right'] ) ? sprintf( 'margin-right: calc( -1 * %s ) !important;', $padding['right'] ) : ''; $style .= '}'; } @@ -167,6 +169,7 @@ function gutenberg_render_layout_support_flag( $block_content, $block ) { $block_gap = wp_get_global_settings( array( 'spacing', 'blockGap' ) ); $default_layout = wp_get_global_settings( array( 'layout' ) ); + $padding = _wp_array_get( $block, array( 'attrs', 'style', 'padding' ), null ); $has_block_gap_support = isset( $block_gap ) ? null !== $block_gap : false; $default_block_layout = _wp_array_get( $block_type->supports, array( '__experimentalLayout', 'default' ), array() ); $used_layout = isset( $block['attrs']['layout'] ) ? $block['attrs']['layout'] : $default_block_layout; @@ -175,10 +178,11 @@ function gutenberg_render_layout_support_flag( $block_content, $block ) { return $block_content; } $used_layout = $default_layout; + $padding = isset( $default_layout['padding'] ) ? $default_layout['padding'] : null; } $id = uniqid(); - $style = gutenberg_get_layout_style( ".wp-container-$id", $used_layout, $has_block_gap_support ); + $style = gutenberg_get_layout_style( ".wp-container-$id", $used_layout, $padding, $has_block_gap_support ); $container_class = 'wp-container-' . $id . ' '; $justify_class = $used_layout['justifyContent'] ? 'wp-justify-' . $used_layout['justifyContent'] . ' ' : ''; // This assumes the hook only applies to blocks with a single wrapper. diff --git a/lib/compat/wordpress-5.9/class-wp-theme-json-gutenberg.php b/lib/compat/wordpress-5.9/class-wp-theme-json-gutenberg.php index 7d7b8dd165f3f..e72bd17ca77be 100644 --- a/lib/compat/wordpress-5.9/class-wp-theme-json-gutenberg.php +++ b/lib/compat/wordpress-5.9/class-wp-theme-json-gutenberg.php @@ -234,9 +234,9 @@ class WP_Theme_JSON_Gutenberg { ), 'custom' => null, 'layout' => array( - 'contentSize' => null, - 'wideSize' => null, - 'outerPadding' => null, + 'contentSize' => null, + 'wideSize' => null, + 'padding' => null, ), 'spacing' => array( 'blockGap' => null, diff --git a/packages/block-editor/src/hooks/layout.js b/packages/block-editor/src/hooks/layout.js index a1f17c525c0c6..930e263a83fd3 100644 --- a/packages/block-editor/src/hooks/layout.js +++ b/packages/block-editor/src/hooks/layout.js @@ -2,7 +2,7 @@ * External dependencies */ import classnames from 'classnames'; -import { has } from 'lodash'; +import { get, has } from 'lodash'; /** * WordPress dependencies @@ -34,23 +34,15 @@ const layoutBlockSupportKey = '__experimentalLayout'; function LayoutPanel( { setAttributes, attributes, name: blockName } ) { const { layout } = attributes; - const defaultThemeLayout = useSetting( 'layout' ); - const themeSupportsLayout = useSelect( ( select ) => { - const { getSettings } = select( blockEditorStore ); - return getSettings().supportsLayout; - }, [] ); - - const layoutBlockSupport = getBlockSupport( - blockName, - layoutBlockSupportKey, - {} + const { supportsFlowLayout, defaultLayout, config } = useLayout( + blockName ); const { allowSwitching, allowEditing = true, allowInheriting = true, default: defaultBlockLayout, - } = layoutBlockSupport; + } = config; if ( ! allowEditing ) { return null; @@ -58,12 +50,7 @@ function LayoutPanel( { setAttributes, attributes, name: blockName } ) { const usedLayout = layout || defaultBlockLayout || {}; const { inherit = false, type = 'default' } = usedLayout; - /** - * `themeSupportsLayout` is only relevant to the `default/flow` - * layout and it should not be taken into account when other - * `layout` types are used. - */ - if ( type === 'default' && ! themeSupportsLayout ) { + if ( type === 'default' && ! supportsFlowLayout ) { return null; } const layoutType = getLayoutType( type ); @@ -77,7 +64,7 @@ function LayoutPanel( { setAttributes, attributes, name: blockName } ) { <> - { allowInheriting && !! defaultThemeLayout && ( + { allowInheriting && !! defaultLayout && ( ) } @@ -109,7 +96,7 @@ function LayoutPanel( { setAttributes, attributes, name: blockName } ) { ) } @@ -134,6 +121,26 @@ function LayoutTypeSwitcher( { type, onChange } ) { ); } +export function useLayout( blockName ) { + const defaultThemeLayout = useSetting( 'layout' ); + const themeSupportsLayout = useSelect( ( select ) => { + const { getSettings } = select( blockEditorStore ); + return getSettings().supportsLayout; + }, [] ); + + const layoutBlockSupport = getBlockSupport( + blockName, + layoutBlockSupportKey, + {} + ); + + return { + supportsFlowLayout: themeSupportsLayout, + defaultLayout: defaultThemeLayout, + config: layoutBlockSupport, + }; +} + /** * Filters registered block settings, extending attributes to include `layout`. * @@ -203,6 +210,9 @@ export const withLayoutStyles = createHigherOrderComponent( const usedLayout = layout?.inherit ? defaultThemeLayout : layout || defaultBlockLayout || {}; + const padding = layout?.inherit + ? usedLayout?.padding + : get( attributes, [ 'style', 'padding' ] ); const className = classnames( props?.className, { [ `wp-container-${ id }` ]: shouldRenderLayoutStyles, } ); @@ -215,6 +225,7 @@ export const withLayoutStyles = createHigherOrderComponent( , element ) } diff --git a/packages/block-editor/src/hooks/padding.js b/packages/block-editor/src/hooks/padding.js index f01276baefdf1..770543a967899 100644 --- a/packages/block-editor/src/hooks/padding.js +++ b/packages/block-editor/src/hooks/padding.js @@ -20,6 +20,7 @@ import { useIsDimensionsSupportValid, } from './dimensions'; import { cleanEmptyObject } from './utils'; +import { useLayout } from './layout'; /** * Determines if there is padding support. @@ -72,11 +73,19 @@ export function resetPadding( { attributes = {}, setAttributes } ) { * * @return {boolean} Whether padding setting is disabled. */ -export function useIsPaddingDisabled( { name: blockName } = {} ) { +export function useIsPaddingDisabled( { name: blockName, attributes } = {} ) { + const { supportsFlowLayout, config } = useLayout( blockName ); + const hasInheritedLayout = + supportsFlowLayout && !! config && attributes?.layout?.inherit; const isDisabled = ! useSetting( 'spacing.padding' ); const isInvalid = ! useIsDimensionsSupportValid( blockName, 'padding' ); - return ! hasPaddingSupport( blockName ) || isDisabled || isInvalid; + return ( + ! hasPaddingSupport( blockName ) || + hasInheritedLayout || + isDisabled || + isInvalid + ); } /** diff --git a/packages/block-editor/src/layouts/flow.js b/packages/block-editor/src/layouts/flow.js index 9408e73f6fed6..ba83fcdb3b52c 100644 --- a/packages/block-editor/src/layouts/flow.js +++ b/packages/block-editor/src/layouts/flow.js @@ -105,18 +105,20 @@ export default { toolBarControls: function DefaultLayoutToolbarControls() { return null; }, - save: function DefaultLayoutStyle( { selector, layout = {} } ) { - const { contentSize, wideSize, outerPadding } = layout; + save: function DefaultLayoutStyle( { selector, layout = {}, padding } ) { + const { contentSize, wideSize } = layout; const blockGapSupport = useSetting( 'spacing.blockGap' ); const hasBlockGapStylesSupport = blockGapSupport !== null; + // Using important here for the padding to override the inline padding that could be potentially + // applied using the custom padding control before the layout inheritance is applied. let style = !! contentSize || !! wideSize ? ` ${ appendSelectors( selector ) } { - padding: ${ outerPadding?.top || 0 } ${ outerPadding?.right || 0 } ${ - outerPadding?.bottom || 0 - } ${ outerPadding?.left || 0 }; + padding: ${ padding?.top || 0 } ${ padding?.right || 0 } ${ + padding?.bottom || 0 + } ${ padding?.left || 0 } !important; } ${ appendSelectors( selector, '> *' ) } { @@ -131,8 +133,8 @@ export default { ${ appendSelectors( selector, '> [data-align="full"]' ) } { max-width: none; - margin-left: calc( -1 * ${ outerPadding.left || 0 } ) !important; - margin-right: calc( -1 * ${ outerPadding.right || 0 } ) !important; + margin-left: calc( -1 * ${ padding.left || 0 } ) !important; + margin-right: calc( -1 * ${ padding.right || 0 } ) !important; } ` : ''; diff --git a/packages/edit-post/src/components/visual-editor/index.js b/packages/edit-post/src/components/visual-editor/index.js index df88856372652..f8ddd0fb15a74 100644 --- a/packages/edit-post/src/components/visual-editor/index.js +++ b/packages/edit-post/src/components/visual-editor/index.js @@ -176,6 +176,14 @@ export default function VisualEditor( { styles } ) { return undefined; }, [ isTemplateMode, themeSupportsLayout, defaultLayout ] ); + const padding = useMemo( () => { + if ( isTemplateMode || ! themeSupportsLayout ) { + return undefined; + } + + return defaultLayout?.padding; + } ); + return ( ) } { ! isTemplateMode && ( From d77f9530f7f1283655842e811c3a8bdf790bbb1f Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Thu, 4 Nov 2021 16:17:32 +0100 Subject: [PATCH 5/6] Fix JS error when the padding is not a correct object --- packages/block-editor/src/layouts/flow.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/block-editor/src/layouts/flow.js b/packages/block-editor/src/layouts/flow.js index ba83fcdb3b52c..d0ebcada8f468 100644 --- a/packages/block-editor/src/layouts/flow.js +++ b/packages/block-editor/src/layouts/flow.js @@ -133,8 +133,8 @@ export default { ${ appendSelectors( selector, '> [data-align="full"]' ) } { max-width: none; - margin-left: calc( -1 * ${ padding.left || 0 } ) !important; - margin-right: calc( -1 * ${ padding.right || 0 } ) !important; + margin-left: calc( -1 * ${ padding?.left || 0 } ) !important; + margin-right: calc( -1 * ${ padding?.right || 0 } ) !important; } ` : ''; From d241ae2b08fc7389505deacd4bf1e7bc025b20f7 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Mon, 29 Nov 2021 09:17:32 +0100 Subject: [PATCH 6/6] Fix unit tests --- lib/block-supports/layout.php | 2 +- .../blocks/core__navigation__deprecated.serialized.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/block-supports/layout.php b/lib/block-supports/layout.php index df712681ef714..3821d3244c0e1 100644 --- a/lib/block-supports/layout.php +++ b/lib/block-supports/layout.php @@ -53,7 +53,7 @@ function gutenberg_get_layout_style( $selector, $layout, $padding, $has_block_ga $style = ''; if ( $content_size || $wide_size ) { - $style = "$selector {"; + $style = "$selector {"; // Using important here to override the inline padding that could be potentially // applied using the custom padding control before the layout inheritance is applied. $style .= sprintf( diff --git a/test/integration/fixtures/blocks/core__navigation__deprecated.serialized.html b/test/integration/fixtures/blocks/core__navigation__deprecated.serialized.html index e3a1a7ee03582..44abf966aa4b2 100644 --- a/test/integration/fixtures/blocks/core__navigation__deprecated.serialized.html +++ b/test/integration/fixtures/blocks/core__navigation__deprecated.serialized.html @@ -1,3 +1,3 @@ - +