From bcca27b79a6d623ee3bdb5f02b9a5c8a6fca7130 Mon Sep 17 00:00:00 2001 From: Aseer KT Date: Tue, 6 Aug 2024 21:17:53 +0530 Subject: [PATCH] chore: remove shift enter behaviour from message composer --- .../message/components/MessageComposer.tsx | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/web/src/features/message/components/MessageComposer.tsx b/web/src/features/message/components/MessageComposer.tsx index df8782c..ad40001 100644 --- a/web/src/features/message/components/MessageComposer.tsx +++ b/web/src/features/message/components/MessageComposer.tsx @@ -25,9 +25,9 @@ export const MessageComposer = ({ const [disabled, setDisabled] = useState(false) const socketRef = useRef(getSocketIO()) const timeoutRef = useRef() - const textAreaRef = useRef(null) + const inputRef = useRef(null) - useAutoFocus(textAreaRef, [groupId, receiverId, replyMessage]) + useAutoFocus(inputRef, [groupId, receiverId, replyMessage]) const handleChange = (e: React.ChangeEvent) => { setText(e.target.value) @@ -80,17 +80,17 @@ export const MessageComposer = ({ handleComposeMessage() } - const handleKeyDown = (event: React.KeyboardEvent) => { - if (event.key === 'Enter' && !event.shiftKey) { - event.preventDefault() - } - if (event.key === 'Enter') { - if (!event.shiftKey) { - event.preventDefault() - handleComposeMessage() - } - } - } + // const handleKeyDown = (event: React.KeyboardEvent) => { + // if (event.key === 'Enter' && !event.shiftKey) { + // event.preventDefault() + // } + // if (event.key === 'Enter') { + // if (!event.shiftKey) { + // event.preventDefault() + // handleComposeMessage() + // } + // } + // } return (