From a75dd4c69b33241a41a542ae0c9e3195fbe42ca4 Mon Sep 17 00:00:00 2001 From: akanshaaaa19 Date: Tue, 16 Apr 2024 12:22:52 +0530 Subject: [PATCH 1/2] fixed cursor position --- src/containers/Chat/ChatMessages/ChatInput/ChatInput.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/containers/Chat/ChatMessages/ChatInput/ChatInput.tsx b/src/containers/Chat/ChatMessages/ChatInput/ChatInput.tsx index 1beff3e36..38ecb5acf 100644 --- a/src/containers/Chat/ChatMessages/ChatInput/ChatInput.tsx +++ b/src/containers/Chat/ChatMessages/ChatInput/ChatInput.tsx @@ -131,7 +131,6 @@ export const ChatInput = ({ setAttachmentAdded(false); setAttachmentURL(''); setAttachmentType(''); - resetVariable(); } }, }); @@ -205,14 +204,13 @@ export const ChatInput = ({ null, Number(selectedTemplate.id) ); - resetVariable(); // else the type will by default be text } else { onSendMessage(message, null, 'TEXT', selectedTemplate, variableParam); - resetVariable(); } // Resetting the EditorState + resetVariable(); editor.dispatchCommand(CLEAR_EDITOR_COMMAND, undefined); editor.focus(); }; From 867413ec0f94b0262b846743a0feb8617dd854c5 Mon Sep 17 00:00:00 2001 From: akanshaaaa19 Date: Fri, 19 Apr 2024 09:57:42 +0530 Subject: [PATCH 2/2] fixed cursor position on removing template messages --- src/containers/Chat/ChatMessages/ChatInput/ChatInput.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/containers/Chat/ChatMessages/ChatInput/ChatInput.tsx b/src/containers/Chat/ChatMessages/ChatInput/ChatInput.tsx index 38ecb5acf..aa91b1869 100644 --- a/src/containers/Chat/ChatMessages/ChatInput/ChatInput.tsx +++ b/src/containers/Chat/ChatMessages/ChatInput/ChatInput.tsx @@ -289,6 +289,8 @@ export const ChatInput = ({ const handleCancel = () => { resetAttachment(); resetVariable(); + editor.dispatchCommand(CLEAR_EDITOR_COMMAND, undefined); + editor.focus(); }; const updateEditorState = (body: string) => { @@ -484,10 +486,7 @@ export const ChatInput = ({ { - resetVariable(); - resetAttachment(); - }} + onClick={handleCancel} >