diff --git a/lib/block-supports/layout.php b/lib/block-supports/layout.php index 3e2082f1514ddb..2403583c66156b 100644 --- a/lib/block-supports/layout.php +++ b/lib/block-supports/layout.php @@ -471,6 +471,12 @@ function gutenberg_get_layout_style( $selector, $layout, $has_block_gap_support 'selector' => $selector, 'declarations' => array( 'grid-template-columns' => 'repeat(' . $layout['columnCount'] . ', minmax(0, 1fr))' ), ); + if ( ! empty( $layout['rowCount'] ) ) { + $layout_styles[] = array( + 'selector' => $selector, + 'declarations' => array( 'grid-template-rows' => 'repeat(' . $layout['rowCount'] . ', minmax(0, 1fr))' ), + ); + } } else { $minimum_column_width = ! empty( $layout['minimumColumnWidth'] ) ? $layout['minimumColumnWidth'] : '12rem'; diff --git a/packages/block-editor/src/layouts/grid.js b/packages/block-editor/src/layouts/grid.js index a2f051ecf78c9a..e71e1739447aac 100644 --- a/packages/block-editor/src/layouts/grid.js +++ b/packages/block-editor/src/layouts/grid.js @@ -69,7 +69,9 @@ export default { layout = {}, onChange, clientId, + layoutBlockSupport = {}, } ) { + const { allowSizingOnChildren = false } = layoutBlockSupport; return ( <> { layout?.columnCount ? ( - ) : ( - - { __( 'Columns' ) } - - - - { - /** - * If the input is cleared, avoid switching - * back to "Auto" by setting a value of "1". - */ - const validValue = value !== '' ? value : '1'; - onChange( { - ...layout, - columnCount: validValue, - } ); - } } - value={ columnCount } - min={ 1 } - label={ __( 'Columns' ) } - hideLabelFromVision - /> - - - - onChange( { - ...layout, - columnCount: value, - } ) - } - min={ 1 } - max={ 16 } - withInputField={ false } - label={ __( 'Columns' ) } - hideLabelFromVision - /> - - - + <> +
+ + { __( 'Columns' ) } + + + + { + /** + * If the input is cleared, avoid switching + * back to "Auto" by setting a value of "1". + */ + const validValue = value !== '' ? value : '1'; + onChange( { + ...layout, + columnCount: validValue, + } ); + } } + value={ columnCount } + min={ 1 } + label={ __( 'Columns' ) } + hideLabelFromVision + /> + + + + onChange( { + ...layout, + columnCount: value, + } ) + } + min={ 1 } + max={ 16 } + withInputField={ false } + label={ __( 'Columns' ) } + hideLabelFromVision + /> + + +
+ { allowSizingOnChildren && + window.__experimentalEnableGridInteractivity && ( +
+ + { __( 'Rows' ) } + + + + { + onChange( { + ...layout, + rowCount: value, + } ); + } } + value={ rowCount } + min={ 1 } + label={ __( 'Rows' ) } + hideLabelFromVision + /> + + + + onChange( { + ...layout, + rowCount: value, + } ) + } + min={ 1 } + max={ 16 } + withInputField={ false } + label={ __( 'Rows' ) } + hideLabelFromVision + /> + + +
+ ) } + ); }