From 4e725f52b3d04d45a241e9d26961d049c6d7c17d Mon Sep 17 00:00:00 2001 From: Umang Utkarsh Date: Sun, 18 Feb 2024 18:16:19 +0530 Subject: [PATCH] bug-fix --- .../react/src/components/ChatInput/ChatInput.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/react/src/components/ChatInput/ChatInput.js b/packages/react/src/components/ChatInput/ChatInput.js index 06e5ff8c2..375dfcdc4 100644 --- a/packages/react/src/components/ChatInput/ChatInput.js +++ b/packages/react/src/components/ChatInput/ChatInput.js @@ -146,7 +146,6 @@ const ChatInput = ({ scrollToBottom }) => { }; const sendMessage = async () => { - scrollToBottom(); messageRef.current.style.height = '44px'; const message = messageRef.current.value.trim(); if (!message.length || !isUserAuthenticated) { @@ -210,6 +209,8 @@ const ChatInput = ({ scrollToBottom }) => { setDisableButton(true); setEditMessage({}); } + + scrollToBottom(); }; const sendAttachment = (event) => { @@ -278,11 +279,18 @@ const ChatInput = ({ scrollToBottom }) => { const handleMemberClick = (selectedItem) => { setshowMembersList(false); + console.log(messageRef.current.value); let insertionText; if (selectedItem === 'all') { - insertionText = `@all `; + insertionText = `${messageRef.current.value.substring( + 0, + messageRef.current.value.lastIndexOf('@') + )}@all `; } else if (selectedItem === 'here') { - insertionText = `@here `; + insertionText = `${messageRef.current.value.substring( + 0, + messageRef.current.value.lastIndexOf('@') + )}@here `; } else { insertionText = `${messageRef.current.value.substring( 0,