feat: Accept files dropped onto the canvas - #79
Merged
Merged
Conversation
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
I extended canvas drops to files dragged in from the operating system. The
dropevent added in #77 only calledgetData(drop_type), and an OS file drag has the type"Files"with no string payload, so there was nothing to read.With
"Files"indrop_types, the canvas reads each dropped file as text and emitsdropwithdataset to a list of{"name", "type", "size", "content"}.positionandtargetare resolved before the files are read, because the browser clears the event once the handler yields. Errors while reading are reported through the existingclient_errorpath. Other drop types behave as before. panel-flowdash uses this to recreate a dashboard from its downloaded JSON file.Save
{"nodes": [{"id": "a", "position": {"x": 0, "y": 0}, "label": "A", "data": {}}], "edges": []}asgraph.jsonand drag it onto the canvas to load node A.I added UI tests for a drop of two files and for a file drop being ignored when
"Files"is not indrop_types, documented the payload in thedrop_typesdocstring, theon()event list and "React to Events", and added 0.5.1 release notes. The drop UI tests pass (7).AI Disclosure
Tool & Model: Kilo Code + Claude Opus 5.5
Usage: Implemented the file drop support, tests and docs while adding dashboard import to panel-flowdash, and drafted this description; I reviewed the diff and ran the listed checks.
Checklist