mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 17:36:27 +00:00
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:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user