From f4b45b21a4ce457f0e7d1cde69f444e902eeed4d Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Fri, 14 Sep 2018 18:20:57 +0700 Subject: [PATCH] the sequence of check of data types in a clipboard's data is changed, now works fine if you want to paste (Ctrl-V) the image copied (Ctrl-C) from the html page --- web/script.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/web/script.js b/web/script.js index ca4c2a0..9b3a213 100644 --- a/web/script.js +++ b/web/script.js @@ -191,12 +191,7 @@ angular.module('Squirrelly', ['ngRoute', 'ngResource']) var paste = {}; - if (/text\/plain|text\/html/.test(e.clipboardData.types)) { - - var blob = new Blob([e.clipboardData.getData('text/plain')], {type : 'text/plain'}); - UploadService.uploadFile(blob); - - } else if (/Files/.test(e.clipboardData.types)) { + if (/Files/.test(e.clipboardData.types)) { for (var i = 0; i < e.clipboardData.items.length; i++) { if (e.clipboardData.items[i].kind == 'file' && e.clipboardData.items[i].type == 'image/png') { @@ -208,6 +203,12 @@ angular.module('Squirrelly', ['ngRoute', 'ngResource']) break; } } + + } else if (/text\/plain|text\/html/.test(e.clipboardData.types)) { + + var blob = new Blob([e.clipboardData.getData('text/plain')], {type : 'text/plain'}); + UploadService.uploadFile(blob); + } }); }