fix edit input mouse pos

This commit is contained in:
hjlarry 2025-09-17 20:40:59 +08:00
parent ea17f41b5b
commit e2547413d3
1 changed files with 11 additions and 0 deletions

View File

@ -206,6 +206,17 @@ export const MentionInput: FC<MentionInputProps> = memo(({
resetMentionState()
}, [value, resetMentionState])
useEffect(() => {
if (autoFocus && textareaRef.current) {
const textarea = textareaRef.current
setTimeout(() => {
textarea.focus()
const length = textarea.value.length
textarea.setSelectionRange(length, length)
}, 0)
}
}, [autoFocus])
return (
<>
<div className={cn('relative flex items-center', className)}>