fix: Add multiple file paste support and fix for bugs (#4066)

- Add multiple files paste support.
- Fixes showing file name in the editor field when we paste the file from finder.
- Fixes showing the image in the advance editor when we paste the image as an attachment from the clipboard.

Fixes: #4036

Co-authored-by: Nithin David <1277421+nithindavid@users.noreply.github.com>
This commit is contained in:
Sivin Varghese
2022-03-23 18:25:57 +05:30
committed by GitHub
parent 4a21633a2b
commit 86b4183bde
3 changed files with 28 additions and 8 deletions

View File

@@ -452,12 +452,16 @@ export default {
methods: {
onPaste(e) {
const data = e.clipboardData.files;
if (!this.showRichContentEditor && data.length !== 0) {
this.$refs.messageInput.$el.blur();
}
if (!data.length || !data[0]) {
return;
}
const file = data[0];
const { name, type, size } = file;
this.onFileUpload({ name, type, size, file });
data.forEach(file => {
const { name, type, size } = file;
this.onFileUpload({ name, type, size, file: file });
});
},
toggleUserMention(currentMentionState) {
this.hasUserMention = currentMentionState;