Skip to content

[new feature] Open Finder-dropped Markdown files as one-time previews #179

@jsgrrchg

Description

@jsgrrchg

Context

A user expected to drag a Markdown file from Finder into the workspace and have the app open it for a one-off preview. The current external drag/drop path reaches the workspace, but openDroppedVaultPathsAtTarget only opens paths that already exist in vaultStore.entries, so files outside the vault are silently ignored.

Proposed behavior

  • Dropping a supported external file from Finder onto an editor pane opens a temporary, read-only preview tab.
  • The file is not copied into the vault.
  • The file is not added to the file tree.
  • The tab is not persisted/restored across sessions.
  • The tab does not participate in autosave, dirty state, inline review, agent edited-files, or accept/reject change flows.
  • If the dropped file is already inside the vault, keep the existing behavior and open it as a normal vault-backed tab.
  • If the drop lands on a file tree folder, keep the existing behavior and copy the external file into that folder.

Initial scope

Support Markdown/text-like files first, especially .md, .mdx, .txt, and other safe text formats. The header can identify the tab as External Preview and expose Open Externally / Reveal in Finder actions.

Implementation notes

  • Model this explicitly as a temporary/read-only external preview instead of treating it as a normal editable vault file.
  • Avoid routing external preview tabs through useEditableFileResource, because that flow assumes relativePath is vault-scoped and saves via save_vault_file.
  • Add a small backend read command for external preview metadata/content, with file existence/type validation and size limits.

Edge cases to cover

  • External file dropped onto workspace pane opens a preview.
  • External file dropped onto file tree folder copies into the vault instead.
  • Vault file dragged from Finder opens as a normal vault tab.
  • Multiple dropped files preserve order and insert consecutive tabs.
  • Pane-edge drops create/use split panes correctly.
  • Large text files are truncated or rejected without freezing the UI.
  • Unsupported binaries/directories do not get read as text.
  • Deleted/moved external files fail gracefully for Open Externally and Reveal in Finder.
  • External previews are excluded from session restore, review state, autosave, and agent change tracking.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions