Repository navigation
Desktop: drag and drop of files from the file manager (#418) - #447
Merged
Merged
Conversation
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
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
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.
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": trueon the main window. The existingcore:defaultcapability already includescore:event:default/core:webview:default, which is whatonDragDropEventneeds, 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:addwhen 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).refusewith 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.newin every other case.An empty drop returns
null.dropLabelandskippedTextbuild the overlay line and the note about skipped folders.desktop/ui/js/drop.js(new): listens togetCurrentWebview().onDragDropEvent..drop-overlayframe with what the drop will do, and a refusal style (body.drop-refused) when the drop will be refused.dropped_filescommand (regular files only, folders counted and named in a toast), routes again, and then opensnewItemDialog({paths}), opensaddFilesDialog(tab, paths)or shows the refusal toast.main.jsboot().desktop/ui/js/workspace.js:addFilesDialog(tab, presetPaths). When it gets dropped paths it skipspick_files. The Add files… button still opens the picker.Rust (
desktop/src):dropped_filescommand (registered inmain.rs) built onaddfiles::split_dropped. It keeps regular files in their order, each once, and counts what it left out.addfiles::planandnew_item_copynow refuse anything that is not a regular file.new_item_placesalready did.dropped_paths_keep_regular_files_only, andrefusalsextended with a folder and a path that does not exist.CSS:
.drop-overlay/.drop-overlay-textplus the refusal variant indesktop/ui/app.css, using skin tokens only and no inline styles.Tab reordering is unchanged.
tabs.jsalready moves tabs with pointer events andsetPointerCapture, 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.mdarchitecture map.Testing
scripts/check-desktop-modules.mjs, and the newscripts/desktop-drop-route.test.mjs, which is added to theuijob indesktop.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 --allwas run indesktop/.Checklist
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).
CHANGELOG.md,README.md,docs/src/**,docs/OPEN_WORK.mdwhere it applies).cargo fmt --all --check,cargo clippy --all-targets -- -D warningsand
cargo testpass locally, or CI runs them. (fmt was run; clippy and tests are left to CI.)🤖 Generated with Claude Code