diff --git a/src/app/Schemas.ts b/src/app/Schemas.ts index 66b7b9ea..4a7332d6 100644 --- a/src/app/Schemas.ts +++ b/src/app/Schemas.ts @@ -75,14 +75,13 @@ export async function getModel(version: VersionId, id: string): Promise } function NumberSuffix({ path, config, integer, value }: NodeProps) { + const [text, setText] = useState(value ?? '') const onChange = (evt: Event) => { - const value = (evt.target as HTMLInputElement).value - const parsed = integer ? parseInt(value) : parseFloat(value) - if (value.length > 0 && !value.match(/\.0*$/)) { - path.model.set(path, parsed) - } - } - const onBlur = (evt: Event) => { const value = (evt.target as HTMLInputElement).value const parsed = integer ? parseInt(value) : parseFloat(value) path.model.set(path, parsed) + setText(value) + } + const onBlur = () => { + setText(value ?? '') } const onColor = (evt: Event) => { const value = (evt.target as HTMLInputElement).value const parsed = parseInt(value.slice(1), 16) path.model.set(path, parsed) + setText(parsed) } return <> - + {config?.color && } {path.equals(new Path(['generator', 'seed'])) && }