mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-23 10:00:08 +08:00
fix(Inputbar): do not reset selection on focus (#5866)
This commit is contained in:
parent
1375d1a1c2
commit
d66e8cb4ec
@ -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)}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user