mirror of https://github.com/zulip/zulip.git
Patch filedrop for jQuery 3 compatibility.
This entails removing the use of jQuery.event.props, which has been removed from jQuery 3.
This commit is contained in:
parent
3d0b5b14be
commit
10fa6b75f9
|
@ -51,8 +51,6 @@
|
|||
*/
|
||||
;(function($) {
|
||||
|
||||
jQuery.event.props.push("dataTransfer");
|
||||
|
||||
var default_opts = {
|
||||
fallback_id: '',
|
||||
url: '',
|
||||
|
@ -113,6 +111,11 @@
|
|||
});
|
||||
|
||||
function drop(e) {
|
||||
if (!e.originalEvent.dataTransfer) {
|
||||
return;
|
||||
}
|
||||
|
||||
files = e.originalEvent.dataTransfer.files;
|
||||
|
||||
function has_type(dom_stringlist, type) {
|
||||
var j;
|
||||
|
@ -124,19 +127,18 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
if (e.dataTransfer.files.length === 0) {
|
||||
if (files.length === 0) {
|
||||
var i;
|
||||
for (i = 0; i < opts.raw_droppable.length; i++) {
|
||||
var type = opts.raw_droppable[i];
|
||||
if (has_type(e.dataTransfer.types, type)) {
|
||||
opts.rawDrop(e.dataTransfer.getData(type));
|
||||
if (has_type(e.originalEvent.dataTransfer.types, type)) {
|
||||
opts.rawDrop(e.originalEvent.dataTransfer.getData(type));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( opts.drop.call(this, e) === false ) return false;
|
||||
files = e.dataTransfer.files;
|
||||
if (files === null || files === undefined || files.length === 0) {
|
||||
opts.error(errors[0]);
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue