File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 250250 @input =" onChangeInput"
251251 @keydown.esc =" escapeTextarea"
252252 @keydown.enter.exact.prevent =" "
253+ @paste =" pasteImage"
253254 />
254255
255256 <div class =" vac-icon-textarea" >
@@ -943,6 +944,25 @@ export default {
943944 this .$refs .file .value = ' '
944945 this .$refs .file .click ()
945946 },
947+ pasteImage (pasteEvent , callback ) {
948+ if (pasteEvent .clipboardData === false ) {
949+ if (typeof (callback) === ' function' ) {
950+ callback (undefined )
951+ }
952+ }
953+ this .clipboardData = pasteEvent .clipboardData .items
954+ var items = pasteEvent .clipboardData .items
955+ if (items === undefined ) {
956+ if (typeof (callback) === ' function' ) {
957+ callback (undefined )
958+ }
959+ }
960+ for (var i = 0 ; i < items .length ; i++ ) {
961+ if (items[i].type .indexOf (' image' ) === - 1 ) continue
962+ var blob = items[i].getAsFile ()
963+ this .onFileChange ([blob])
964+ }
965+ },
946966 async onFileChange (files ) {
947967 this .fileDialog = true
948968 this .resetMediaFile ()
You can’t perform that action at this time.
0 commit comments