Skip to content

Commit 883fb30

Browse files
committed
minor bug fix
1 parent c9335cc commit 883fb30

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/components/advanced-range-control/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,11 @@ const AdvancedRangeControl = props => {
269269
// Since the actual previous value is a preset, force the new custom value
270270
// when changing unit
271271
controlProps.onChangeUnit = ( unit, unitAttrName ) => {
272+
dispatch( 'core/block-editor' ).__unstableMarkNextChangeAsNotPersistent()
272273
setAttributes( { [ unitAttrName ]: unit } )
274+
if ( props.onChangeUnit ) {
275+
props.onChangeUnit( unit )
276+
}
273277
_onChange( _newValue )
274278
}
275279
}

src/components/font-size-control/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const FontSizeControl = props => {
3939
placeholder={ passedPlaceholder }
4040
onChangeUnit={ value => {
4141
// Change font-size so as not to surprise the user.
42-
if ( props.value !== '' && ! isNaN( Number( value ) ) ) {
42+
if ( props.value !== '' && ! isNaN( Number( props.value ) ) ) {
4343
if ( value === 'em' || value === 'rem' ) {
4444
props.onChange( String( pxToEm( props.value ) ) )
4545
} else if ( value === 'px' ) {

src/components/four-range-control/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,12 @@ const FourRangeControl = memo( props => {
439439
// Since the actual previous value is a preset, force the new custom value
440440
// when changing unit
441441
controlProps.onChangeUnit = ( unit, unitAttrName ) => {
442-
initialOnChange( _newValue )
442+
dispatch( 'core/block-editor' ).__unstableMarkNextChangeAsNotPersistent()
443443
setAttributes( { [ unitAttrName ]: unit } )
444+
if ( props.onChangeUnit ) {
445+
props.onChangeUnit( unit )
446+
}
447+
initialOnChange( _newValue )
444448
}
445449
}
446450

0 commit comments

Comments
 (0)