Skip to content

feat: #3565 move files and folders by dragging in the sidebar - #5945

Merged
Jocs merged 6 commits into
developfrom
feat/3565-sidebar-drag-move
Oct 30, 2026
Merged

Jocs merged 6 commits into
developfrom
feat/3565-sidebar-drag-move

Conversation

@Jocs

@Jocs Jocs commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Closes #3565. Also addresses the sidebar movement requests in #1052, #3201 and #3302.

Summary

The sidebar can currently move items through Cut/Paste, but cannot move files or folders by dragging. Add single-item drag moves within one open root: drop onto another folder, a file inside that folder, or the root heading, confirm the actual disk move, and keep the moved document open at its new path.

  • Resolve file-row hover and drops to the containing directory, sharing the existing row registry and the same target validation as folder-row drops. Highlight the receiving folder and preserve the hover timer when moving between its files.
  • Provide target highlighting, hover expansion, edge scrolling and selection/reveal after completion. Explicit move-completion reveals use the existing reveal flow and shared row registry, taking precedence over automatic active-file reveals until the user navigates again, including when no document is open.
  • Reuse the existing main-process move coordinator and save barriers to relocate open descendants without discarding dirty edits or recreating old paths on save. Capture a relocation plan before disk mutation, including the source alias and canonical identity, and use the same mapping for open documents and application recent-file paths.
  • Validate paths in the main process before confirmation and again before writing. Reject collisions, directory cycles, linked paths below the workspace root, different volumes and resources open in another window. A workspace root itself may be a symlink.
  • Keep drag handling in one tree-level controller; file and folder rows only expose node metadata. No new dependencies.

Type of change

  • Bug fix (non-breaking, fixes an issue)
  • New feature (non-breaking, adds functionality)
  • Breaking change (causes existing functionality to change)
  • Documentation update

Test plan

  • New tests added for disk moves, cancellation, revalidation, conflicts, symlinks, device boundaries, drag lifecycle, ancestor reveal and recent paths.
  • pnpm run lint — no errors; existing warnings remain.
  • pnpm run typecheck
  • pnpm run test:unit — 1,717 tests passed, including move-watch recovery, reveal delegation, filesystem-aware case matching and consecutive symlink-workspace moves.
  • pnpm run build:unpack
  • 37 Electron E2E tests on macOS: drag moves, automatic/explicit reveal, sidebar focus, inline creation/rename and external reload regressions. Includes native file and folder drops onto files in an expanded directory and back onto root files, selection with no open document, a 60-file folder with automatic reveal enabled, injected source deletion followed by move failure, consecutive native drags in a symlink workspace, slow session persistence, dirty descendants and pending autosave. The injected failure verifies deletion flags, notifications and persisted main-process recovery state.
  • Windows and Linux runtime validation.

Move-related old-path deletion notifications are suppressed at the file watcher before reaching either session state or the renderer, until every affected document has relocated and rebound its watcher. On failure, the main-process move scope rechecks the old watched paths and reports genuinely missing files through the existing observer and renderer deletion flow. There is no separate renderer compensation path. Unrelated paths and windows remain observable.

Notes for reviewers

This is a bounded MVP: one item, one window and one root per move. Multi-select, cross-root/window moves, drag-to-copy, custom ordering and automatic Markdown link repair are deferred. The confirmation explains the effect on relative links and image paths. Other windows must close affected documents before a move can proceed.

This PR closes #3565 with the core sidebar movement workflow. Arbitrary custom ordering remains outside this MVP and can be tracked separately. It does not change external file-move/autosave behavior discussed in #3509.

Visual evidence has been captured locally; screenshot upload is still pending. Generated evidence is not committed to the repository.


By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Website preview ready: https://pr-5945-marktext-website.ransixi.workers.dev

Built from 9e76a33ac4ff6b448d7f559c241d0867247e4a92 · Worker: marktext-website · Version: db64f6f4-12eb-4a05-9bbb-2a5a363e20ba · Alias: pr-5945

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Build artifacts for PR #5945:

Run: https://github.com/marktext/marktext/actions/runs/41030457444

Artifact Size Link
marktext-macos-x64 332.7 MB Download
marktext-windows-x64 335.7 MB Download
marktext-linux-x64 731.2 MB Download
marktext-windows-arm64 327.6 MB Download
marktext-linux-arm64 572.2 MB Download
marktext-macos-arm64 321.1 MB Download

@Jocs
Jocs merged commit 56520f8 into develop Oct 30, 2026
14 checks passed
Tkaixiang added a commit that referenced this pull request Nov 23, 2026
…te keys on build (#6120)

* fix(i18n): translate strings left in English

Several feature PRs added English placeholder values to most locales and
they were never translated:

- sideBar.move.* (13 keys, #5945): de, es, fr, ja, ko, nl, pt, ru, tr, zh-TW
- multi-folder sidebar strings (12 keys, #5835): de, es, fr, ja, ko, nl, pt,
  ru, tr
- preferences.editor.fileRepresentation.tabInputNotes (#5891): same 9 locales

Also fills one-off gaps: GitHub Alerts labels in pl (desktop and Muya) and
it (Muya), the Academic export theme in it, and the super/subscript
extension label in es and pt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chore(i18n): remove unused locale keys

None of these keys is referenced anywhere in packages/desktop/src, either
as a literal or through a template/prefix key:

- menu.counter.document, documentSelection, charactersNoSpaces,
  allCharacters
- sideBar.tree.noFolders, overlappingFolder
- sideBar.search.searchInFolder (the UI uses searchInFolders)
- preferences.theme.modeThemes
- dialog.file, files, keepOpen, saveFailure
- error.report, unexpectedErrorWithMessage
- store.editor.anchorLinkCopied
- editor.sourceCode.cursorNullComment, imageStructureDeletedComment
- readingMode.skipped

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* build(i18n): validate locale keys before minifying

minify-locales now fails, before writing any .min.json, when:

- a locale is missing a key from en.json or has a key en.json lacks
- an en.json key is not referenced by any .ts or .vue file under
  packages/desktop/src

The usage check is a single ripgrep pass that collects quoted dotted
strings. Template literals (`menu.theme.${name}`) and concatenation
prefixes ('sideBar.move.') match as patterns, so keys built from a
variable still count as used. ripgrep comes from @vscode/ripgrep,
resolved through packages/desktop, which already declares it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

Drag and droppable file system

1 participant