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 }}
|
styles={{ textarea: TextareaStyle }}
|
||||||
onFocus={(e: React.FocusEvent<HTMLTextAreaElement>) => {
|
onFocus={(e: React.FocusEvent<HTMLTextAreaElement>) => {
|
||||||
setInputFocus(true)
|
setInputFocus(true)
|
||||||
const textArea = e.target
|
if (e.target.value.length === 0) {
|
||||||
if (textArea) {
|
e.target.setSelectionRange(0, 0)
|
||||||
const length = textArea.value.length
|
|
||||||
textArea.setSelectionRange(length, length)
|
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
onBlur={() => setInputFocus(false)}
|
onBlur={() => setInputFocus(false)}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user