Skip to content

Commit

Permalink
supporting both Enter and NumpadEnter
Browse files Browse the repository at this point in the history
  • Loading branch information
jmlord committed Sep 19, 2023
1 parent e5b5d34 commit b1c8c32
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ui/src/components/form/ScriptInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ export default function ScriptInput({ type, value, options, onValueUpdated, ...p
case 'int':
return <input type='text' {...passedProps} defaultValue={value}
placeholder={CONSTANT_PLACEHOLDER}
onKeyDown={e => { if (e.code === "Enter") onValueUpdated(parseInt(e.target.value)) }}
onKeyDown={e => { if (e.key === "Enter") onValueUpdated(parseInt(e.target.value)) }}
onBlur={e => onValueUpdated(parseInt(e.target.value))} />

case 'float':
return <input type='text' {...passedProps} defaultValue={value}
placeholder={CONSTANT_PLACEHOLDER}
onKeyDown={e => { if (e.code === "Enter") onValueUpdated(parseFloat(e.target.value)) }}
onKeyDown={e => { if (e.key === "Enter") onValueUpdated(parseFloat(e.target.value)) }}
onBlur={e => onValueUpdated(parseFloat(e.target.value))} />

default:
Expand All @@ -67,7 +67,7 @@ export default function ScriptInput({ type, value, options, onValueUpdated, ...p
return <AutoResizeTextArea {...props} />
} else {
return <input type='text' {...props}
onKeyDown={e => { if (e.code === "Enter") updateValue(e) }} />
onKeyDown={e => { if (e.key === "Enter") updateValue(e) }} />
}
}
}

0 comments on commit b1c8c32

Please sign in to comment.