Added a check to filedrop plugin to check whether pasted content has strings.

If the pasted content has strings, we don't upload included files and instead
allow the default behavior to take place. This deals with a quirky behavior of
pastes from MS Word, which in addition to the formatted string content also
includes a thumbnail of it. Images still paste as usual.

(imported from commit 60c4f8dd90ac2e8e38940fb302cc9d1ebeecfdf3)
This commit is contained in:
Allen Rabinovich
2013-04-24 11:40:10 -07:00
parent 91b4e8d25d
commit f863a9b567

View File

@@ -128,6 +128,18 @@
return; return;
} }
// Check if any of the items are strings, and if they are,
// then return, since we want the default browser behavior
// to deal with those.
var itemsLength = event.originalEvent.clipboardData.items.length;
for (var i = 0; i < itemsLength; i++) {
if (event.originalEvent.clipboardData.items[i].kind === "string") {
return;
}
}
// Take the first image pasted in the clipboard // Take the first image pasted in the clipboard
var match_re = /image.*/; var match_re = /image.*/;
var item; var item;