File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
packages/neos-ui-editors/src/Editors/Range Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -41,8 +41,9 @@ class RangeEditor extends PureComponent {
41
41
handleChange = event => {
42
42
const { options} = this . props ;
43
43
const { target} = event ;
44
+ const useParseInt = ( options . step || 1 ) % 1 === 0 ;
44
45
45
- let value = parseInt ( target . value , 10 ) ;
46
+ let value = useParseInt ? parseInt ( target . value , 10 ) : parseFloat ( target . value , 10 ) ;
46
47
if ( isNaN ( value ) ) {
47
48
return ;
48
49
}
@@ -64,7 +65,10 @@ class RangeEditor extends PureComponent {
64
65
const options = { ...this . constructor . defaultProps . options , ...this . props . options } ;
65
66
const { value, highlight} = this . props ;
66
67
const valueAsString = value === 0 ? '0' : ( value || '' ) ;
67
- const styleWidth = Math . max ( options . min . toString ( ) . length , options . max . toString ( ) . length ) + 'ch' ;
68
+ // Calculate the width of the input field based on the length of the min, max and step values
69
+ const numLength = value => value . toString ( ) . length ;
70
+ const additionalStepLength = numLength ( options . step ) - 1 ;
71
+ const styleWidth = Math . max ( numLength ( options . min ) , numLength ( options . max ) ) + additionalStepLength + 'ch' ;
68
72
69
73
return (
70
74
< div
You can’t perform that action at this time.
0 commit comments