mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-29 00:20:04 +01:00
web: limit input value between mix/max
This commit is contained in:
@@ -463,7 +463,14 @@ function SettingItem(props: { item: Setting }) {
|
||||
defaultValue={component.defaultValue()}
|
||||
sx={{ width: 80, mr: 1 }}
|
||||
onChange={debounce((e) => {
|
||||
component.onChange(e.target.valueAsNumber);
|
||||
let value = e.target.valueAsNumber;
|
||||
value =
|
||||
Number.isNaN(value) || value < component.min
|
||||
? component.min
|
||||
: value > component.max
|
||||
? component.max
|
||||
: value;
|
||||
component.onChange(value);
|
||||
}, 500)}
|
||||
/>
|
||||
) : (
|
||||
|
||||
Reference in New Issue
Block a user