mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-09-30 11:12:35 +02:00
Adds page-wide drag-and-drop file upload to the File Manager
tab — drop any file anywhere on the page and the upload modal
opens pre-populated with the dropped files. The Upload Files
button still works for click-to-browse.
Also fixes the Archives drag-cancel bug @maikolscripts reported
in the same issue: cancelling a drag (drag back outside the
browser, Escape mid-drag, or release outside the page) used to
leave the overlay stuck until page refresh.
Both pages share a new hook usePageFileDrop. The fix:
- relatedTarget containment check (catches drag-out-of-window)
- document-level drop / dragend / keydown(Escape) listeners
that only register while isDraggingOver === true, so the
three cancel paths all reset uniformly
FileUploadModal gains an optional initialFiles prop so the
File Manager page can pre-seed the modal from a page-wide
drop. seededInitialRef guards against re-adding on re-renders.
Permission gate: File Manager drop zone disabled when the
user lacks library:upload, so a viewer-tier user doesn't get
a misleading overlay.