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

feat: allow dropping folders #8032

Merged
merged 5 commits into from
Oct 30, 2024
Merged

feat: allow dropping folders #8032

merged 5 commits into from
Oct 30, 2024

Conversation

sissbruecker
Copy link
Contributor

@sissbruecker sissbruecker commented Oct 29, 2024

Allows to drop folders into the upload component. Folders will be scanned recursively for files and any file found will be added to the file list for uploading. It's also possible to drop a combination of files and folders. Files are still filtered by the accept filter and any non-matching file will be discarded.

Just noting that this doesn't introduce any new concepts such as having folders as a separate entry in the upload component. This is just a shortcut for adding all files from a folder to the upload.

Part of #857

@sissbruecker sissbruecker marked this pull request as ready for review October 30, 2024 08:44
}

const filePromises = Array.from(dropEvent.dataTransfer.items)
.map((item) => item.webkitGetAsEntry())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment webkitGetAsEntry seems to be the only API that allows retrieving a folder from a data transfer item that is supported by all browsers.

There is also getAsFileSystemHandle, but that isn't supported by FF or Safari. Then there are some mentions of other APIs in the referenced issue, none of which seem to have made it into the standard.

sissbruecker and others added 2 commits October 30, 2024 11:53
Co-authored-by: Sergey Vinogradov <mr.vursen@gmail.com>
Copy link

sonarcloud bot commented Oct 30, 2024

@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 24.6.0.beta1 and is also targeting the upcoming stable 24.6.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants