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

[experimental] Native file dragging plugin #1584

Draft
wants to merge 6 commits into
base: experimental
Choose a base branch
from

Conversation

yf-yang
Copy link

@yf-yang yf-yang commented Jan 7, 2025

This PR aims at providing a plugin to drag and drop file from native fs to browser.

It is marked as draft because:

  • When dropping, activationEvent's data transfer is already cleared, so the file data is not accessible

I don't know how to fix it. Would you consider passing the DOM event to core dnd-kit events (dragstart, dragend, dragmove...)?

fixes #1581

Copy link

changeset-bot bot commented Jan 7, 2025

🦋 Changeset detected

Latest commit: 313af6a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@dnd-kit/abstract Minor
@dnd-kit/dom Minor
@dnd-kit/collision Minor
@dnd-kit/helpers Minor
@dnd-kit/react Minor
@dnd-kit/geometry Minor
@dnd-kit/state Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

"build:core": "tsup src/core/index.ts",
"build:modifiers": "tsup --entry.modifiers src/modifiers/index.ts",
"build:plugins": "tsup --entry.debug src/plugins/debug/index.ts --outDir ./plugins",
"build:draggableFile": "tsup --entry.draggableFile src/plugins/draggableFile/index.ts --outDir ./plugins",
Copy link
Author

Choose a reason for hiding this comment

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

Didn't take times figuring out how to configure the command. Put it here for now

@yf-yang

This comment was marked as resolved.

@yf-yang yf-yang changed the title Native file dragging plugin [experimental] Native file dragging plugin Jan 7, 2025

if (!status.initialized || !shape) {
if (!status.initialized) {
return DEFAULT_VALUE;
Copy link
Author

Choose a reason for hiding this comment

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

It should be collision detection algorithm's responsibility to check shape's availability. File draggable does not have a shape and would be filtered by the original code implementation

@yf-yang yf-yang marked this pull request as ready for review January 8, 2025 04:39
@yf-yang yf-yang marked this pull request as draft January 8, 2025 04:49
// Make sure effects will re-run when those properties change
void position.current;
void shape;

Copy link
Author

@yf-yang yf-yang Jan 8, 2025

Choose a reason for hiding this comment

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

I don't know if it has a performance penalty (too many collisions recompute?)

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

Successfully merging this pull request may close these issues.

1 participant