diff --git a/app/assets/javascripts/app/lib/base/html5Upload.js b/app/assets/javascripts/app/lib/base/html5Upload.js index 2a78163b0..016dc2115 100644 --- a/app/assets/javascripts/app/lib/base/html5Upload.js +++ b/app/assets/javascripts/app/lib/base/html5Upload.js @@ -102,11 +102,16 @@ } }; onDrop = function (e) { - inCounter = 0 - onDragEnter(e); - hideDropZone(dropContainer) + e.preventDefault() + e.stopPropagation() manager.processFiles(e.dataTransfer.files) }; + onDragEnd = function (e) { + inCounter = 0 + e.preventDefault() + e.stopPropagation() + hideDropZone(dropContainer) + }; showDropZone = function(dropContainer) { $(dropContainer).trigger('html5Upload.dropZone.show') @@ -126,6 +131,7 @@ manager.on(dropContainer, 'dragleave', onDragLeave) manager.on(dropContainer, 'dragover', onDragOver) manager.on(dropContainer, 'dragenter', onDragEnter) + manager.on(dropContainer, 'dragend', onDragEnd) manager.on(dropContainer, 'drop', onDrop) } diff --git a/app/assets/javascripts/app/lib/base/jquery.contenteditable.js b/app/assets/javascripts/app/lib/base/jquery.contenteditable.js index 7947049ec..940073406 100644 --- a/app/assets/javascripts/app/lib/base/jquery.contenteditable.js +++ b/app/assets/javascripts/app/lib/base/jquery.contenteditable.js @@ -432,6 +432,8 @@ y = e.clientY var file = dataTransfer.files[0] + if(!file) return; + // look for images if (file.type.match('image.*')) { var reader = new FileReader() @@ -610,4 +612,4 @@ return plugin.value() } -}(jQuery)); \ No newline at end of file +}(jQuery));