Skip to content

Drag & Drop functionality #39

Closed
coderanik wants to merge 5 commits intomainfrom
feat/drag-drop
Closed

Drag & Drop functionality #39
coderanik wants to merge 5 commits intomainfrom
feat/drag-drop

Conversation

@coderanik
Copy link
Collaborator

This PR adds and fixes multiple bugs with the Drag & Drop functionality and perfects the workflow for importing external .md files into the Cinder Notes application. Previously, there were event bubbling conflicts and UI flickering issues when dragging files above the app window.

✨ Key Changes
Resolved Drag Event Conflict: Updated drag handlers in FileExplorer.tsx to explicitly ignore external file drags (e.dataTransfer.types.includes('Files')). This correctly allows the drag events to bubble up to the MainLayout, avoiding the scenario where the sidebar intercepted drops intended for the whole app.
Fixed Overlay Flickering: Improved handleWindowDragLeave in MainLayout.tsx by using !e.currentTarget.contains(e.relatedTarget as Node) instead of e.currentTarget === e.target. This ensures the "Drop files here" overlay remains solidly visible when dragging over editor child elements, instead of unexpectedly hiding.

App-wide Drag Initialization: Added handleWindowDragEnter to naturally trigger the file drop overlay the instant an external file enters the window boundaries.

Preserved File Tree Functionality: Ensured that native (internal) workspace drag-and-drop operations, like moving files to the root, remain cleanly separated from cross-application file imports.

- Add global isDraggingFiles state to app store
- Implement full-window drag overlay in MainLayout
- Move drop handling from FileExplorer to MainLayout
- Files can now be dropped anywhere in the window and will be imported to explorer
- Overlay shows 'Drop files here' message with blur effect
- Automatically hides overlay after drop or cancel
@coderanik coderanik requested a review from 7sg56 as a code owner March 13, 2026 16:45
@coderanik coderanik closed this Mar 13, 2026
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