feat: enter换行,取消enter发送
This commit is contained in:
parent
0a98af35e9
commit
9417348b94
|
|
@ -860,12 +860,15 @@ export const PromptInputBody = ({
|
|||
|
||||
export type PromptInputTextareaProps = ComponentProps<
|
||||
typeof InputGroupTextarea
|
||||
>;
|
||||
> & {
|
||||
submitOnEnter?: boolean;
|
||||
};
|
||||
|
||||
export const PromptInputTextarea = ({
|
||||
onChange,
|
||||
className,
|
||||
placeholder = "What would you like to know?",
|
||||
submitOnEnter = true,
|
||||
...props
|
||||
}: PromptInputTextareaProps) => {
|
||||
const controller = useOptionalPromptInputController();
|
||||
|
|
@ -877,6 +880,9 @@ export const PromptInputTextarea = ({
|
|||
if (isComposing || e.nativeEvent.isComposing) {
|
||||
return;
|
||||
}
|
||||
if (!submitOnEnter) {
|
||||
return;
|
||||
}
|
||||
if (e.shiftKey) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -342,6 +342,7 @@ export function InputBox({
|
|||
"size-full",
|
||||
!effectiveIsFocused && "h-[80px] py-0 leading-20",
|
||||
)}
|
||||
submitOnEnter={false}
|
||||
disabled={isInputDisabled}
|
||||
placeholder={t.inputBox.placeholder}
|
||||
autoFocus={autoFocus}
|
||||
|
|
|
|||
Loading…
Reference in New Issue