Skip to content

Commit

Permalink
BUGFIX: Allow float numbers as steps in RangeEditor
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnitto committed Oct 23, 2023
1 parent 3b89b9a commit ec2a2b5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/neos-ui-editors/src/Editors/Range/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class RangeEditor extends PureComponent {
const {options} = this.props;
const {target} = event;

let value = parseInt(target.value, 10);
let value = parseFloat(target.value, 10);
if (isNaN(value)) {
return;
}
Expand All @@ -64,7 +64,10 @@ class RangeEditor extends PureComponent {
const options = {...this.constructor.defaultProps.options, ...this.props.options};
const {value, highlight} = this.props;
const valueAsString = value === 0 ? '0' : (value || '');
const styleWidth = Math.max(options.min.toString().length, options.max.toString().length) + 'ch';
// Calculate the width of the input field based on the length of the min, max and step values
const numLength = (value) => value.toString().length;

Check failure on line 68 in packages/neos-ui-editors/src/Editors/Range/index.js

View workflow job for this annotation

GitHub Actions / Code style

Unexpected parentheses around single function argument
const additionalStepLength = numLength(options.step) - 1;
const styleWidth = Math.max(numLength(options.min), numLength(options.max)) + additionalStepLength + 'ch';

return (
<div
Expand Down

0 comments on commit ec2a2b5

Please sign in to comment.