Skip to content

Commit

Permalink
Merge pull request #2861 from glific/bug/cursor-position
Browse files Browse the repository at this point in the history
Fixed the cursor position
  • Loading branch information
mdshamoon authored Apr 19, 2024
2 parents e7a785e + d674b6e commit 2d88278
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/containers/Chat/ChatMessages/ChatInput/ChatInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ export const ChatInput = ({
setAttachmentAdded(false);
setAttachmentURL('');
setAttachmentType('');
resetVariable();
}
},
});
Expand Down Expand Up @@ -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();
};
Expand Down Expand Up @@ -291,6 +289,8 @@ export const ChatInput = ({
const handleCancel = () => {
resetAttachment();
resetVariable();
editor.dispatchCommand(CLEAR_EDITOR_COMMAND, undefined);
editor.focus();
};

const updateEditorState = (body: string) => {
Expand Down Expand Up @@ -486,10 +486,7 @@ export const ChatInput = ({
<Tooltip title={t('Remove message')} placement="top">
<IconButton
className={updatedEditorState ? styles.CrossIcon : styles.CrossIconWithVariable}
onClick={() => {
resetVariable();
resetAttachment();
}}
onClick={handleCancel}
>
<CrossIcon />
</IconButton>
Expand Down

0 comments on commit 2d88278

Please sign in to comment.