Skip to content

Commit

Permalink
Merge branch 'master' into fix/copy
Browse files Browse the repository at this point in the history
  • Loading branch information
kurund authored Sep 3, 2024
2 parents f77780b + 97bfd7f commit e9a40b1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ export const AddAttachment = ({
}}
handleCancel={() => {
setAttachment(false);

setAttachmentURL('');
setAttachmentAdded(false);
}}
Expand Down
12 changes: 12 additions & 0 deletions src/containers/Chat/ChatMessages/ChatInput/ChatInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,17 @@ export const ChatInput = ({
// check for an empty message or message with just spaces
if ((!message || /^\s*$/.test(message)) && !attachmentAdded) return;

//check if it has media if the template type is image
if (
selectedTemplate &&
selectedTemplate.isHsm &&
selectedTemplate.type !== 'TEXT' &&
!attachmentAdded
) {
setAttachment(!attachment);
return;
}

// check if there is any attachment
if (attachmentAdded) {
createMediaMessage({
Expand Down Expand Up @@ -288,6 +299,7 @@ export const ChatInput = ({
const handleCancel = () => {
resetAttachment();
resetVariable();
setSelectedTemplate(undefined);
editor.dispatchCommand(CLEAR_EDITOR_COMMAND, undefined);
editor.focus();
};
Expand Down

0 comments on commit e9a40b1

Please sign in to comment.