Skip to content

Commit

Permalink
Block Editor: Prevent negative width values in Spacer block when used…
Browse files Browse the repository at this point in the history
… inside a row block
  • Loading branch information
himanshupathak95 committed Jan 23, 2025
1 parent 0d35e9f commit f0d0c0e
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function helpText( selfStretch, parentLayout ) {
*
* @param {boolean} props.isShownByDefault
* @param {string} props.panelId
* @param {number} [props.minUnitValue=0] Minimum allowed value for the unit control
* @return {Element} child layout edit element.
*/
export default function ChildLayoutControl( {
Expand All @@ -56,6 +57,7 @@ export default function ChildLayoutControl( {
parentLayout,
isShownByDefault,
panelId,
minUnitValue = 0,
} ) {
const {
type: parentType,
Expand All @@ -71,6 +73,7 @@ export default function ChildLayoutControl( {
parentLayout={ parentLayout }
isShownByDefault={ isShownByDefault }
panelId={ panelId }
minUnitValue={ minUnitValue }
/>
);
} else if ( parentLayoutType === 'grid' ) {
Expand All @@ -94,6 +97,7 @@ function FlexControls( {
parentLayout,
isShownByDefault,
panelId,
minUnitValue,
} ) {
const { selfStretch, flexSize } = childLayout;
const { orientation = 'horizontal' } = parentLayout ?? {};
Expand Down Expand Up @@ -188,6 +192,7 @@ function FlexControls( {
} );
} }
value={ flexSize }
min={ minUnitValue }
label={ flexResetLabel }
hideLabelFromVision
/>
Expand Down

0 comments on commit f0d0c0e

Please sign in to comment.