diff --git a/web/src/components/message-input/index.tsx b/web/src/components/message-input/index.tsx index a20147a50..0780261af 100644 --- a/web/src/components/message-input/index.tsx +++ b/web/src/components/message-input/index.tsx @@ -35,6 +35,7 @@ import { useEffect, useRef, useState, + KeyboardEventHandler, } from 'react'; import FileIcon from '../file-icon'; import styles from './index.less'; @@ -155,6 +156,13 @@ const MessageInput = ({ setFileList([]); }, [fileList, onPressEnter, isUploadingFile]); + const handleInputKeyDown: KeyboardEventHandler = (e) => { + if (e.key === 'Enter' && !e.nativeEvent.shiftKey) { + e.preventDefault(); + handlePressEnter(); + } + }; + const handleRemove = useCallback( async (file: UploadFile) => { const ids = get(file, 'response.data', []); @@ -202,45 +210,46 @@ const MessageInput = ({ return ( - - {showUploadIcon && ( - { - return false; - }} - > - - - )} - - - } - onPressEnter={handlePressEnter} - onChange={onInputChange} - /> + + + )} + + + {fileList.length > 0 && (