Allow dropping of raw text and urls without showing an error

Don't show an error if we can't handle the drop contents, since it may
just be empty rather than being a browser unsupported issue

(imported from commit 986495b4a94f4afacf75ffb35ea507d86c369b2f)
This commit is contained in:
Leo Franchi
2013-04-19 13:02:38 -04:00
parent 14fd888a08
commit 80e8e7b21e
2 changed files with 16 additions and 0 deletions

View File

@@ -35,6 +35,7 @@
refresh: 1000,
paramname: 'userfile',
allowedfiletypes:[],
raw_droppable:[],
maxfiles: 25, // Ignored if queuefiles is set > 0
maxfilesize: 1, // MB file size limit
queuefiles: 0, // Max files before queueing (for large volume uploads)
@@ -42,6 +43,7 @@
data: {},
headers: {},
drop: empty,
rawDrop: empty,
dragStart: empty,
dragEnter: empty,
dragOver: empty,
@@ -84,6 +86,15 @@
});
function drop(e) {
var i;
for (i = 0; i < opts.raw_droppable.length; i++) {
var type = opts.raw_droppable[i];
if (e.dataTransfer.types.indexOf(type) > -1) {
opts.rawDrop(e.dataTransfer.getData(type));
return false;
}
}
if( opts.drop.call(this, e) === false ) return false;
files = e.dataTransfer.files;
if (files === null || files === undefined || files.length === 0) {