Skip to content

Commit

Permalink
feat: fixed child block unit controls issue with unit reset
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayank-Tripathi32 committed Dec 20, 2024
1 parent d0adbf8 commit d08a55a
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
__experimentalVStack as VStack,
__experimentalToolsPanelItem as ToolsPanelItem,
__experimentalUseCustomUnits as useCustomUnits,
__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,
Flex,
FlexItem,
} from '@wordpress/components';
Expand Down Expand Up @@ -182,6 +183,11 @@ function FlexControls( {
size="__unstable-large"
units={ units }
onChange={ ( value ) => {
if ( value === '' ) {
const [ , currentUnit ] =
parseQuantityAndUnitFromRawValue( flexSize );
value = `0${ currentUnit || 'px' }`;
}
onChange( {
selfStretch,
flexSize: value,
Expand Down

0 comments on commit d08a55a

Please sign in to comment.