feat: Add the ability to send attachment in new conversation (#7913)

This commit is contained in:
Sivin Varghese
2023-10-10 09:34:36 +05:30
committed by GitHub
parent 8189dd932c
commit 759a66dd21
15 changed files with 487 additions and 60 deletions

View File

@@ -86,6 +86,7 @@
</div>
<div v-if="hasAttachments" class="attachment-preview-box" @paste="onPaste">
<attachment-preview
class="mt-4 flex-col"
:attachments="attachedFiles"
:remove-attachment="removeAttachment"
/>
@@ -115,6 +116,7 @@
:toggle-audio-recorder="toggleAudioRecorder"
:toggle-emoji-picker="toggleEmojiPicker"
:message="message"
:new-conversation-modal-active="newConversationModalActive"
@selectWhatsappTemplate="openWhatsappTemplateModal"
@toggle-editor="toggleRichContentEditor"
@replace-text="replaceText"
@@ -241,6 +243,7 @@ export default {
showUserMentions: false,
showCannedMenu: false,
showVariablesMenu: false,
newConversationModalActive: false,
};
},
computed: {
@@ -567,11 +570,25 @@ export default {
500,
true
);
// A hacky fix to solve the drag and drop
// Is showing on top of new conversation modal drag and drop
// TODO need to find a better solution
bus.$on(
BUS_EVENTS.NEW_CONVERSATION_MODAL,
this.onNewConversationModalActive
);
},
destroyed() {
document.removeEventListener('paste', this.onPaste);
document.removeEventListener('keydown', this.handleKeyEvents);
},
beforeDestroy() {
bus.$off(
BUS_EVENTS.NEW_CONVERSATION_MODAL,
this.onNewConversationModalActive
);
},
methods: {
toggleRichContentEditor() {
this.updateUISettings({
@@ -1060,6 +1077,14 @@ export default {
this.bccEmails = bcc.join(', ');
this.toEmails = to.join(', ');
},
onNewConversationModalActive(isActive) {
// Issue is if the new conversation modal is open and we drag and drop the file
// then the file is not getting attached to the new conversation modal
// and it is getting attached to the current conversation reply box
// so to fix this we are removing the drag and drop event listener from the current conversation reply box
// When new conversation modal is open
this.newConversationModalActive = isActive;
},
},
};
</script>