meteor-file-collection
meteor-file-collection copied to clipboard
Preventing multiple drop zones from being activated (unAssignDrop not working)
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"));
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
Thank you for your answer. But for the second part of my question, shouldn't calling Files.resumable.unAssignDrop remove the specified drop zone?
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
@schaazzz we use this to clear events.
Documents.resumable.events = [];
its okay to put it into "comp did mount" or "comp will unmount ".