Commit ca9d7754 by Sixong.Zhu

file drop

parent 5e7bd01c
Showing with 15 additions and 0 deletions
......@@ -54,6 +54,7 @@
@input="$emit('input')"
@keypress.enter="handleSendMsg"
@keyup.enter="handleReturn"
@drop="onFileDrop"
></div>
</el-scrollbar>
......@@ -579,6 +580,20 @@
this.percentage = 0;
}
}
private onFileDrop(e: DragEvent) {
e.stopPropagation();
e.preventDefault();
const files = e.dataTransfer.files;
if (files && files.length) {
const file = files[0];
if (this.isImage(file)) {
this.insertHtmlAtCaret(this.buildImageHtml(file));
} else {
this.insertHtmlAtCaret(this.buildFileHtml(file));
}
}
}
}
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment