Skip to content

Commit

Permalink
Fix buggy fill state
Browse files Browse the repository at this point in the history
  • Loading branch information
tellthemachines committed Apr 13, 2023
1 parent e3d1364 commit 7d751d2
Showing 1 changed file with 35 additions and 3 deletions.
38 changes: 35 additions & 3 deletions packages/block-library/src/spacer/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,19 +254,51 @@ const SpacerEdit = ( {
width: '72px',
} );
}
if ( isFlexLayout && ! flexSize ) {
if (
isFlexLayout &&
selfStretch !== 'fill' &&
selfStretch !== 'fit' &&
! flexSize
) {
const newSize =
inheritedOrientation === 'horizontal'
? getSpacingPresetCssVar( width ) || '72px'
: getSpacingPresetCssVar( height ) || '100px';
setAttributes( {
style: {
...blockStyle,
layout: {
...layout,
flexSize: width || '72px',
flexSize: newSize,
selfStretch: 'fixed',
},
},
} );
} else if (
isFlexLayout &&
( selfStretch === 'fill' || selfStretch === 'fit' )
) {
if ( inheritedOrientation === 'horizontal' ) {
setAttributes( {
width: '0px',
} );
} else {
setAttributes( {
height: '0px',
} );
}
}
}, [] );
}, [
blockStyle,
flexSize,
height,
inheritedOrientation,
isFlexLayout,
layout,
selfStretch,
setAttributes,
width,
] );

return (
<>
Expand Down

0 comments on commit 7d751d2

Please sign in to comment.