# File drag-and-drop design ## Intent Allow users to move a file between folders in the file manager by dragging it onto a folder, including the root destination, without breaking references from notes. ## Goals and non-goals - Dragging a file onto a folder moves it there; dropping onto the root returns it to the root. - Preserve the file ID, blob, and note association. The existing note reference remains valid. - Reuse `PUT /api/files/{id}/move` with the target folder ID; do not duplicate or delete stored bytes. - Keep current list filters, preview, and selection/picker behavior intact. - Context menus and a file-information window are outside this change. ## Approaches 1. **Move the existing file record (selected):** update its folder via the existing API. This preserves its ID and note references and avoids physical copying. 2. Duplicate the blob under a new ID, rewrite note references, then delete the source. This adds failure and consistency risks without improving the requested user-visible result. ## Interaction and constraints - Use native browser drag-and-drop on file rows and folder-tree destinations; mark valid targets while dragging and clear that state on drop/cancel. - Disable drag-and-drop in picker mode. - Dropping onto the current folder is a no-op. - After a successful move, reload the file tree/list and retain the destination folder as the current view where applicable; on API failure, leave the UI data intact and show an error. - No backend schema or API changes are needed; the file ID and note association are unchanged. ## Acceptance A file can be dragged from a displayed list into a folder (or root), disappears from its previous location and appears in the destination, and remains accessible from any note that referenced it before the move. Errors do not make the UI claim that a move succeeded.