From 0ef7cc1aaccc4732d59e9062ef71f1135187b512 Mon Sep 17 00:00:00 2001
From: Jared Hancock <gravydish@gmail.com>
Date: Mon, 11 Feb 2019 20:30:27 -0600
Subject: [PATCH] filedrop: Fix file drag and drop

This fixes an issue introduced in the upgrade to jQuery three. The filedrop
field was not updated correctly and drag and drop files was broken.
Additionally, this handles cases where files are dragged over the box but
not dropped. The style of the box is correctly reset after the drag leaves
the box.
---
 js/filedrop.field.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/js/filedrop.field.js b/js/filedrop.field.js
index 42b94e70f..ab5559af3 100644
--- a/js/filedrop.field.js
+++ b/js/filedrop.field.js
@@ -11,6 +11,7 @@
       progressUpdated: $.proxy(this.progressUpdated, this),
       speedUpdated: $.proxy(this.speedUpdated, this),
       dragOver: $.proxy(this.dragOver, this),
+      dragLeave: $.proxy(this.dragLeave, this),
       drop: $.proxy(this.drop, this),
       beforeSend: $.proxy(this.beforeSend, this),
       beforeEach: $.proxy(this.beforeEach, this),
@@ -29,6 +30,9 @@
   };
 
   FileDropbox.prototype = {
+    dragLeave: function(e) {
+        this.$element.removeAttr('style');
+    },
     drop: function(e) {
         this.$element.removeAttr('style');
     },
@@ -361,9 +365,9 @@
 
     function drop(e) {
       if( opts.drop.call(this, e) === false ) return false;
-      if(!e.dataTransfer)
+      if(!e.originalEvent.dataTransfer)
         return;
-      files = e.dataTransfer.files;
+      files = e.originalEvent.dataTransfer.files;
       if (files === null || files === undefined || files.length === 0) {
         opts.error(errors[0]);
         return false;
-- 
GitLab