weixiyen / jquery-filedrop

jQuery plugin - drag and drop desktop files and POST to a URL to handle files.
958 stars 285 forks source link

Prohibits JqueryUI draggable from working. #132

Open jonahgoldsaito opened 11 years ago

jonahgoldsaito commented 11 years ago

Any DOM element that has been run through filedrop() can no longer be used as a jquery UI draggable/sortable component.

I found that by commenting out //.on('dragstart', opts.dragStart); near the top of the file, jquery's draggable/sortable functionality is back in business.

I'm building a web app whose UI has sortable list items that need to be able to accept an image from the desktop.

Commenting that out means that a user defined dragstart method would not be called, but at least in my implementation, I'm not utilizing it. I imagine for others, leaving this out would be a problem.

Could the event be renamed "dragstart.filedrop" and still function.

jonahgoldsaito commented 11 years ago

Hmm... I thought that namespacing the event might allow both to coexist, but apparently not.

cdenley commented 11 years ago

I have them both working, but I had to add a couple lines of code to prevent filedrop from throwing an error on non-file drops.

function drop(e) {
   if( opts.drop.call(this, e) === false ) return false;
   if( typeof(e.dataTransfer) !== 'object' ) return false;
   if(e.dataTransfer === null) return false;
   files = e.dataTransfer.files;