Browse Source

publish muk_web_utils - 12.0

pull/35/head
MuK IT GmbH 6 years ago
parent
commit
b964da6a83
  1. 2
      muk_web_utils/__manifest__.py
  2. 16
      muk_web_utils/static/src/js/core/dropzone.js
  3. 2
      muk_web_utils/static/src/js/core/files.js
  4. 6
      muk_web_utils/static/src/js/libs/jquery.js

2
muk_web_utils/__manifest__.py

@ -20,7 +20,7 @@
{ {
"name": "MuK Web Utils", "name": "MuK Web Utils",
"summary": """Utility Features""", "summary": """Utility Features""",
"version": "12.0.2.4.4",
"version": "12.0.2.4.5",
"category": "Extra Tools", "category": "Extra Tools",
"license": "AGPL-3", "license": "AGPL-3",
"author": "MuK IT", "author": "MuK IT",

16
muk_web_utils/static/src/js/core/dropzone.js

@ -50,14 +50,14 @@ var DropzoneMixin = {
_toggleDropzone: function(state) { _toggleDropzone: function(state) {
this.$dropzone.toggleClass(this.dropzoneClasses, state); this.$dropzone.toggleClass(this.dropzoneClasses, state);
}, },
_hoverDropzoneEnter: function(event) {
if(this._checkDropzoneEvent(event)) {
_hoverDropzoneEnter: function(event, originalEvent) {
if(this._checkDropzoneEvent(originalEvent)) {
this._toggleDropzone(true); this._toggleDropzone(true);
event.preventDefault(); event.preventDefault();
return false; return false;
} }
}, },
_hoverDropzoneLeave: function(event) {
_hoverDropzoneLeave: function(event, originalEvent) {
this._toggleDropzone(false); this._toggleDropzone(false);
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();
@ -99,12 +99,14 @@ var FileDropzoneMixin = _.extend({}, DropzoneMixin, {
dropzoneClasses: DropzoneMixin.dropzoneClasses + ' mk_dropzone_file', dropzoneClasses: DropzoneMixin.dropzoneClasses + ' mk_dropzone_file',
dropzoneCheck: window.File && window.FileReader && window.FileList && window.Blob, dropzoneCheck: window.File && window.FileReader && window.FileList && window.Blob,
_checkDropzoneEvent: function(event) { _checkDropzoneEvent: function(event) {
return this.dropzoneCheck;
var dataTransfer = event.originalEvent && event.originalEvent.dataTransfer;
var fileCheck = dataTransfer && _.some(dataTransfer.types, function(type) {
return type == "Files";
});
return this.dropzoneCheck && fileCheck;
}, },
_handleDrag: function(event) { _handleDrag: function(event) {
if(event.originalEvent.dataTransfer) {
event.originalEvent.dataTransfer.dropEffect = 'copy';
}
event.originalEvent.dataTransfer.dropEffect = 'copy';
}, },
}); });

2
muk_web_utils/static/src/js/core/files.js

@ -43,7 +43,7 @@ var traverseItems = function(items, tree) {
}); });
defs.push(traverse); defs.push(traverse);
} else { } else {
file = item.getAsFile();
var file = item.getAsFile();
if(file) { if(file) {
if(file.size) { if(file.size) {
files.push(_.extend({}, file, {isFileItem: true})); files.push(_.extend({}, file, {isFileItem: true}));

6
muk_web_utils/static/src/js/libs/jquery.js

@ -29,7 +29,7 @@ $.fn.dndHover = function(options) {
var collection = $(); var collection = $();
self.on('dragenter', function(event) { self.on('dragenter', function(event) {
if (collection.size() === 0) { if (collection.size() === 0) {
self.trigger('dndHoverStart');
self.trigger('dndHoverStart', [event]);
} }
collection = collection.add(event.target); collection = collection.add(event.target);
}); });
@ -37,14 +37,14 @@ $.fn.dndHover = function(options) {
setTimeout(function() { setTimeout(function() {
collection = collection.not(event.target); collection = collection.not(event.target);
if (collection.size() === 0) { if (collection.size() === 0) {
self.trigger('dndHoverEnd');
self.trigger('dndHoverEnd', [event]);
} }
}, 1); }, 1);
}); });
self.on('drop', function(event) { self.on('drop', function(event) {
setTimeout(function() { setTimeout(function() {
collection = $(); collection = $();
self.trigger('dndHoverEnd');
self.trigger('dndHoverEnd', [event]);
}, 1); }, 1);
}); });
}); });

Loading…
Cancel
Save