fix: event of keyboard "enter" in text generator app (#3823)

This commit is contained in:
KVOJJJin
2024-04-25 13:58:06 +08:00
committed by GitHub
parent 2a64ce740e
commit 1a7b4c42ab
2 changed files with 6 additions and 1 deletions

View File

@@ -65,6 +65,12 @@ const RunOnce: FC<IRunOnceProps> = ({
placeholder={`${item.name}${!item.required ? `(${t('appDebug.variableTable.optional')})` : ''}`}
value={inputs[item.key]}
onChange={(e) => { onInputsChange({ ...inputs, [item.key]: e.target.value }) }}
onKeyDown={(e) => {
if (e.key === 'Enter') {
e.preventDefault()
onSend()
}
}}
maxLength={item.max_length || DEFAULT_VALUE_MAX_LEN}
/>
)}