enh:setfocus after voice input (#7317)

This commit is contained in:
呆萌闷油瓶
2024-08-15 22:12:51 +08:00
committed by GitHub
parent 135dcfa3e5
commit fcb6921b57

View File

@@ -49,6 +49,7 @@ const ChatInput: FC<ChatInputProps> = ({
const { t } = useTranslation()
const { notify } = useContext(ToastContext)
const [voiceInputShow, setVoiceInputShow] = useState(false)
const textAreaRef = useRef<HTMLTextAreaElement>(null)
const {
files,
onUpload,
@@ -176,6 +177,7 @@ const ChatInput: FC<ChatInputProps> = ({
)
}
<Textarea
ref={textAreaRef}
className={`
block w-full px-2 pr-[118px] py-[7px] leading-5 max-h-none text-sm text-gray-700 outline-none appearance-none resize-none
${visionConfig?.enabled && 'pl-12'}
@@ -234,7 +236,10 @@ const ChatInput: FC<ChatInputProps> = ({
voiceInputShow && (
<VoiceInput
onCancel={() => setVoiceInputShow(false)}
onConverted={text => setQuery(text)}
onConverted={(text) => {
setQuery(text)
textAreaRef.current?.focus()
}}
/>
)
}