fix(web): prompt input add composition
This commit is contained in:
@@ -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}
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user