Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Allow drop folder(s) #2

Merged
merged 4 commits into from
Oct 19, 2020
Merged

Conversation

nithins
Copy link
Contributor

@nithins nithins commented Sep 22, 2020

This feature allows the DropAreaBase to accept folders as well. Folder(s) will be recursively scanned and the files within will be collected into a flat array. The file array is passed on to onSelectFiles

Tested on

  • Firefox 80.0.1 (64-bit/Linux Ubuntu 16.04)
  • Chrome 83.0.4103.97 (Official Build) (64-bit/Linux Ubuntu 16.04)

Resolves #1

@leMaik
Copy link
Member

leMaik commented Sep 22, 2020

Wow, that was quick! Thank you, @nithins 🎉

@nithins
Copy link
Contributor Author

nithins commented Sep 23, 2020

Thanks for the review @leMaik . I've incorporated all the changes.

The only change that feels iffy is on how to check if webkitGetAsEntry API is supported. Currently, the items[0] is being checked . There could be a better way. Please let me know if you can think of anything.

@leMaik
Copy link
Member

leMaik commented Sep 23, 2020

@nithins Thank you! 👏

You could detect support outside of the handler like this:

const folderDropSupported = !!DataTransferItem.prototype.webkitGetAsEntry

Edit: Turns out it's pretty widely supported, I didn't expect that 😮

@nithins
Copy link
Contributor Author

nithins commented Sep 30, 2020

Hi @leMaik . I have completed and checked in the changes on the fork. I'm not sure of how to merge pull requests. Please let me know if there is anything I need to do. Also, I could squash the changes to maintain a single commit before you merge the pull request.

@leMaik leMaik merged commit 0ebf6ef into TeamWertarbyte:master Oct 19, 2020
@leMaik
Copy link
Member

leMaik commented Oct 19, 2020

@nithins Sorry, this went off my radar 😬 I'm publishing a new release right now, thanks again for your work! 🎉

@leMaik leMaik added the enhancement New feature or request label Oct 19, 2020
@nithins
Copy link
Contributor Author

nithins commented Oct 21, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Accept Folders and extract folder files recursively
2 participants