fix(Inputbar): do not reset selection on focus (#5866)

This commit is contained in:
one 2025-05-11 13:47:25 +08:00 committed by GitHub
parent 1375d1a1c2
commit d66e8cb4ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -903,10 +903,8 @@ const Inputbar: FC<Props> = ({ assistant: _assistant, setActiveTopic, topic }) =
styles={{ textarea: TextareaStyle }}
onFocus={(e: React.FocusEvent<HTMLTextAreaElement>) => {
setInputFocus(true)
const textArea = e.target
if (textArea) {
const length = textArea.value.length
textArea.setSelectionRange(length, length)
if (e.target.value.length === 0) {
e.target.setSelectionRange(0, 0)
}
}}
onBlur={() => setInputFocus(false)}