meteor-file-collection icon indicating copy to clipboard operation
meteor-file-collection copied to clipboard

Preventing multiple drop zones from being activated (unAssignDrop not working)

Open schaazzz opened this issue 8 years ago • 4 comments

In my application, I have 2 templates with file upload functionality using drop zones. When I upload files by dragging/dropping on one template, it triggers the file upload on both templates.

I've tried using unAssignDrop in the .onDestroyed callback but that didn't help, any ideas?

I'm assigning the drop zone in the .onRendered callback:

Files.resumable.assignDrop($("#div-attach-files-to-comment"));

And I'm un-assigning the drop zone in the .onDestroyed callback:

Files.resumable.unAssignDrop($("#div-attach-files-to-comment"));

schaazzz avatar Jun 07 '16 02:06 schaazzz

Hi, file-collection only creates a single instance of resumable.js. If you want multiple independent drop zones, you need to create/configure your own resumable.js instance for each template.

See: https://github.com/vsivsi/meteor-file-collection/issues/71

vsivsi avatar Jun 07 '16 16:06 vsivsi

Thank you for your answer. But for the second part of my question, shouldn't calling Files.resumable.unAssignDrop remove the specified drop zone?

schaazzz avatar Jun 08 '16 10:06 schaazzz

I would assume so. If you have questions or issues about resumable.js please be aware that it is an independent project. File-collection only includes it as a convenience. I didn't write it and I don't have time to consult on its use client-side.

You can search the past issues and if necessary submit new ones on the resumable.js repo here: https://github.com/23/resumable.js

vsivsi avatar Jun 08 '16 16:06 vsivsi

@schaazzz we use this to clear events.

Documents.resumable.events = [];

its okay to put it into "comp did mount" or "comp will unmount ".

crapthings avatar Aug 30 '16 10:08 crapthings