fix(web): prompt input add composition

This commit is contained in:
zhaoying
2026-04-08 21:28:36 +08:00
parent 6bb01119d0
commit 5eb65e7ad8
2 changed files with 8 additions and 2 deletions

View File

@@ -185,6 +185,7 @@ const AiPromptModal = forwardRef<AiPromptModalRef, AiPromptModalProps>(({
handleOpen,
}));
const [isFocus, setIsFocus] = useState(false)
const [isComposing, setIsComposing] = useState(false)
const handleFocus = () => {
setIsFocus(true)
}
@@ -236,7 +237,9 @@ const AiPromptModal = forwardRef<AiPromptModalRef, AiPromptModalProps>(({
<Form.Item name="message" className="rb:flex-1 rb:mb-0!">
<Input
placeholder={t(`${source}.promptChatPlaceholder`)}
onPressEnter={handleSend}
onCompositionStart={() => setIsComposing(true)}
onCompositionEnd={() => setIsComposing(false)}
onKeyDown={(e) => { if (e.key === 'Enter' && !isComposing) handleSend() }}
variant="borderless"
className="rb:p-0!"
onFocus={handleFocus}

View File

@@ -169,6 +169,7 @@ const Prompt: FC = () => {
updateSession()
}
const [isFocus, setIsFocus] = useState(false)
const [isComposing, setIsComposing] = useState(false)
const handleFocus = () => {
setIsFocus(true)
}
@@ -209,7 +210,9 @@ const Prompt: FC = () => {
<Form.Item name="message" className="rb:flex-1 rb:mb-0!">
<Input
placeholder={t(`prompt.promptChatPlaceholder`)}
onPressEnter={handleSend}
onCompositionStart={() => setIsComposing(true)}
onCompositionEnd={() => setIsComposing(false)}
onKeyDown={(e) => { if (e.key === 'Enter' && !isComposing) handleSend() }}
variant="borderless"
className="rb:p-0!"
onFocus={handleFocus}