diff --git a/CHANGELOG.md b/CHANGELOG.md index c74318105..11e2d8b0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Groups: initial support for groups. - Profile: add RSS link to user profiles. - Posts: fix posts filtering. +- Chats: reset chat message field height after sending a message. ### Changed - Chats: improved display of media attachments. diff --git a/app/soapbox/features/chats/components/chat-composer.tsx b/app/soapbox/features/chats/components/chat-composer.tsx index 165e7ce9d..23a531d69 100644 --- a/app/soapbox/features/chats/components/chat-composer.tsx +++ b/app/soapbox/features/chats/components/chat-composer.tsx @@ -42,6 +42,7 @@ interface IChatComposer extends Pick void resetFileKey: number | null + resetContentKey: number | null attachments?: Attachment[] onDeleteAttachment?: () => void isUploading?: boolean @@ -58,6 +59,7 @@ const ChatComposer = React.forwardRef disabled = false, onSelectFile, resetFileKey, + resetContentKey, onPaste, attachments = [], onDeleteAttachment, @@ -179,6 +181,7 @@ const ChatComposer = React.forwardRef ); }); -export default ChatComposer; \ No newline at end of file +export default ChatComposer; diff --git a/app/soapbox/features/chats/components/chat.tsx b/app/soapbox/features/chats/components/chat.tsx index 55b0cf2cb..6610cfa00 100644 --- a/app/soapbox/features/chats/components/chat.tsx +++ b/app/soapbox/features/chats/components/chat.tsx @@ -54,6 +54,7 @@ const Chat: React.FC = ({ chat, inputRef, className }) => { const [attachment, setAttachment] = useState(undefined); const [isUploading, setIsUploading] = useState(false); const [uploadProgress, setUploadProgress] = useState(0); + const [resetContentKey, setResetContentKey] = useState(fileKeyGen()); const [resetFileKey, setResetFileKey] = useState(fileKeyGen()); const [errorMessage, setErrorMessage] = useState(); @@ -83,6 +84,7 @@ const Chat: React.FC = ({ chat, inputRef, className }) => { setIsUploading(false); setUploadProgress(0); setResetFileKey(fileKeyGen()); + setResetContentKey(fileKeyGen()); }; const sendMessage = () => { @@ -171,6 +173,7 @@ const Chat: React.FC = ({ chat, inputRef, className }) => { errorMessage={errorMessage} onSelectFile={handleFiles} resetFileKey={resetFileKey} + resetContentKey={resetContentKey} onPaste={handlePaste} attachments={attachment ? [attachment] : []} onDeleteAttachment={handleRemoveFile}