Skip to content

Commit a221ac6

Browse files
authored
Merge pull request #186 from samuelnovaes/master
Paste images with Ctrl + V
2 parents 1bcb9f1 + 4b905b3 commit a221ac6

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/lib/Room/Room.vue

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@
250250
@input="onChangeInput"
251251
@keydown.esc="escapeTextarea"
252252
@keydown.enter.exact.prevent=""
253+
@paste="onPasteImage"
253254
/>
254255

255256
<div class="vac-icon-textarea">
@@ -943,6 +944,18 @@ export default {
943944
this.$refs.file.value = ''
944945
this.$refs.file.click()
945946
},
947+
onPasteImage(pasteEvent) {
948+
const items = pasteEvent.clipboardData?.items
949+
950+
if (items) {
951+
items.forEach(item => {
952+
if (item.type.indexOf('image') !== -1) {
953+
const blob = item.getAsFile()
954+
this.onFileChange([blob])
955+
}
956+
})
957+
}
958+
},
946959
async onFileChange(files) {
947960
this.fileDialog = true
948961
this.resetMediaFile()

0 commit comments

Comments
 (0)