Skip to content

Desktop: drag and drop of files from the file manager (#418) - #447

Merged
Sebagrei merged 3 commits into
mainfrom
feature/418-desktop-drop-files
Nov 22, 2026
Merged

Sebagrei merged 3 commits into
mainfrom
feature/418-desktop-drop-files

Conversation

@Sebagrei

Copy link
Copy Markdown
Collaborator

You can now drag files from Explorer, Finder or the file manager onto the desktop app window.

Closes #418

What changed

  • desktop/tauri.conf.json: "dragDropEnabled": true on the main window. The existing core:default capability already includes core:event:default / core:webview:default, which is what onDragDropEvent needs, so the capability files are unchanged.

  • desktop/ui/js/drop-rules.js (new, pure): routeDrop({paths, tab, hint, canCreate, dialogOpen}) returns one of three results:

    • add when the active tab is a revision whose Add files… works (filesHint(tab.data).ok: checked out by me, or free for me to check out).
    • refuse with filesHint's text for revisions that are released, in review, checked out by someone else, or in a group where the user is not an editor. It also refuses viewers and editors without a group, an open dialog, and a revision that is still loading.
    • new in every other case.

    An empty drop returns null. dropLabel and skippedText build the overlay line and the note about skipped folders.

  • desktop/ui/js/drop.js (new): listens to getCurrentWebview().onDragDropEvent.

    • On enter/over it shows a .drop-overlay frame with what the drop will do, and a refusal style (body.drop-refused) when the drop will be refused.
    • On drop it calls the new dropped_files command (regular files only, folders counted and named in a toast), routes again, and then opens newItemDialog({paths}), opens addFilesDialog(tab, paths) or shows the refusal toast.
    • It is wired in main.js boot().
  • desktop/ui/js/workspace.js: addFilesDialog(tab, presetPaths). When it gets dropped paths it skips pick_files. The Add files… button still opens the picker.

  • Rust (desktop/src):

    • New dropped_files command (registered in main.rs) built on addfiles::split_dropped. It keeps regular files in their order, each once, and counts what it left out.
    • addfiles::plan and new_item_copy now refuse anything that is not a regular file. new_item_places already did.
    • Unit tests: dropped_paths_keep_regular_files_only, and refusals extended with a folder and a path that does not exist.
  • CSS: .drop-overlay / .drop-overlay-text plus the refusal variant in desktop/ui/app.css, using skin tokens only and no inline styles.

  • Tab reordering is unchanged. tabs.js already moves tabs with pointer events and setPointerCapture, not HTML5 drag and drop, and the desktop UI uses HTML5 DnD nowhere else. So turning on the native drop should not break tab dragging.

Docs

CHANGELOG.md (Unreleased / Added), README.md (Desktop app feature), desktop/README.md (Add files row updated, new Drop files row), docs/src/guide/desktop.md (Drop files), docs/OPEN_WORK.md (#418 under #408), docs/src/dev/threat-model.md (new row: dropped paths, same checks as the picker, regular files only), CLAUDE.md architecture map.

Testing

  • Not compiled or run on this machine. The project rule is no builds on this device, and Node.js is not installed here, so the node test has not run locally either. CI verifies: the desktop Rust build, clippy and tests, scripts/check-desktop-modules.mjs, and the new scripts/desktop-drop-route.test.mjs, which is added to the ui job in desktop.yml. That test covers no tab, a checked-out revision, a revision Add files… would check out, one locked by another user, a released revision, one in review, a missing hint, a revision still loading, a viewer, an open dialog, an empty drop, and the labels.
  • cargo fmt --all was run in desktop/.
  • Manual check still needed: dropping files (New / Add files… / refusal / folder skipped) and tab dragging with the native drop turned on, on Windows, macOS and Linux.

Checklist

  • This is my own work (or my AI agent's, written from its own
    knowledge), or openly licensed material under a compatible licence
    that is credited. It contains no code decompiled, disassembled or
    rewritten from proprietary software
    and no leaked code
    (CONTRIBUTING.md).
  • Reading a file format: not applicable (no format reading).
  • The documentation is updated in this pull request (CHANGELOG.md,
    README.md, docs/src/**, docs/OPEN_WORK.md where it applies).
  • cargo fmt --all --check, cargo clippy --all-targets -- -D warnings
    and cargo test pass locally, or CI runs them. (fmt was run; clippy and tests are left to CI.)

🤖 Generated with Claude Code

fork and others added 2 commits November 22, 2026 19:50
Tauri's native file drop is on for the main window. Files dropped on a
revision tab the user has checked out (or that Add files... would check
out) open Add files... with the dropped paths; elsewhere New item with the
files chosen. A frame over the window shows what the drop does; frozen
revisions, revisions checked out by someone else, viewers, editors without
a group and an open dialog refuse it with the reason.

The routing is a pure function (ui/js/drop-rules.js) with node tests
(scripts/desktop-drop-route.test.mjs, run by the ui job). Only regular
files are taken: the new dropped_files command leaves folders out, and
addfiles::plan and new_item_copy refuse anything that is not a regular
file. Tab reordering uses pointer events, so it is unaffected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The drop frame now hides when the dragged items route nowhere (text, a
URL), and its label says "the dropped files" instead of a count that
included folders the drop skips.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Sebagrei
Sebagrei marked this pull request as ready for review November 22, 2026 20:50
…rop-files

# Conflicts:
#	CHANGELOG.md
#	desktop/ui/js/main.js
#	docs/OPEN_WORK.md
@Sebagrei
Sebagrei merged commit dd3a2e1 into main Nov 22, 2026
6 checks passed
@Sebagrei
Sebagrei deleted the feature/418-desktop-drop-files branch November 22, 2026 20:56
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.

UX B4: Drag & drop CAD files from the file manager into the desktop app

1 participant