diff --git a/NEWS b/NEWS index 66ec27344..4e224c610 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,7 @@ Enhancements Bug fixes - [web] fixed crash when an attachment filename has no extension - [web] fixed selection of transparent all-day events (#3744) + - [web] leaving the dropping area while dragging a file was blocking the mail editor - [eas] handle base64 EAS protocol version - [eas] handle missing IMAP folders from a hierarchy using EAS diff --git a/UI/WebServerResources/js/Common/angular-file-upload.trump.js b/UI/WebServerResources/js/Common/angular-file-upload.trump.js index 4b7b53c6d..afbb70ca9 100644 --- a/UI/WebServerResources/js/Common/angular-file-upload.trump.js +++ b/UI/WebServerResources/js/Common/angular-file-upload.trump.js @@ -3,16 +3,16 @@ (function() { 'use strict'; + angular + .module('angularFileUpload') + .decorator('FileUploader', FileUploaderDecorator) + .decorator('FileDrop', FileDropDecorator); + /** * Set XSRF header if the cookie exists. * Solution based on the following discussion: * https://github.com/nervgh/angular-file-upload/issues/360 - */ - angular - .module('angularFileUpload') - .decorator('FileUploader', FileUploaderDecorator); - - /** + * * @ngInject */ FileUploaderDecorator.$inject = ['$delegate', '$cookies']; @@ -24,4 +24,32 @@ }; return $delegate; } + + /** + * Fixed bug causing nv-file-over (over-class) not resetting when leaving element. + * Solution based on this unmerged pull request: + * https://github.com/nervgh/angular-file-upload/pull/643 + * + * @ngInject + */ + FileDropDecorator.$inject = ['$delegate', '$timeout']; + function FileDropDecorator($delegate, $timeout) { + $delegate.prototype.onDragOver = function(event) { + var transfer = this._getTransfer(event); + if (!this._haveFiles(transfer.types)) return; + transfer.dropEffect = 'copy'; + this._preventAndStop(event); + angular.forEach(this.uploader._directives.over, this._addOverClass, this); + $timeout.cancel(this.onDragLeaveTimer); + }; + $delegate.prototype.onDragLeave = function(event) { + var that = this; + $timeout.cancel(this.onDragLeaveTimer); + this.onDragLeaveTimer = $timeout(function() { + that._preventAndStop(event); + angular.forEach(that.uploader._directives.over, that._removeOverClass, that); + }, 50); + }; + return $delegate; + } })();