(js) Fix mail editor when leaving dropping area

pull/217/head
Francis Lachapelle 2016-07-04 12:31:57 -04:00
parent ce6e321f2d
commit 6ba6dcbf09
2 changed files with 35 additions and 6 deletions

1
NEWS
View File

@ -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

View File

@ -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;
}
})();