* docs: add README for Drag Out plugin with installation, usage, and notes * build(esbuild): add esbuild config for bundling main.ts Add configuration to bundle main.ts with environment‑aware settings, minify in production, generate source maps in dev, and watch for changes. Excludes external modules and builtins. * build(main-orig.js): add CommonJS build of main.ts as plugin entry point * build(main.js): add esbuild-generated bundle for Drag Out plugin * feat(main.ts): add DragOut plugin for external file drag support Add DragOutPlugin class with settings, dragstart handling, icon resolution, and a setting tab. Enables dragging files/folders from Obsidian to external applications using a configurable modifier key. Includes debug logging and cross‑platform support. * feat: add manifest.json for Drag Out plugin to define metadata and versioning * chore(package): add package.json with project metadata and build scripts * chore(release): add release.mjs to automate version sync and build Adds a script that reads the package version, updates manifest.json and runs the production build, and copies release artifacts into dist/<version>/. for GitHub releases. * build: add tsconfig.json to configure TypeScript compiler settings * feat: add icon.png and versions.json for app branding and version tracking * remove original handwritten main.js pre-esbuild * docs(license): adds license boilerplate * docs(changelog): add initial changelog file with 0.1.2 entries * docs(readme): add Bun build note and correct formatting Add a note that build scripts rely on Bun, update code block language to text, fix indentation of bullet points, and adjust line breaks for consistency. * refactor(main.js): update minified bundle variable names and improve drag handling logic * refactor(DragOutPlugin): improve drag handling and selection logic - Move event suppression after startDrag to avoid early exit - Simplify selected path extraction with Array.from/map/filter - Ensure current item is added only if not already selected - Reorder comments for clarity and maintainability * refactor(release): separate optional and required files, abort on missing required files This change updates the release script to treat `icon.png` as an optional asset. Missing required files now trigger an error and halt the release, while missing optional files only emit a warning. * docs(changelog): update change notes for platform defaults, drag behavior, README, and icon fallback - Make default modifier key platform‑aware (Ctrl on Windows/Linux, Alt on macOS). - Clarify multi‑select drag behavior: selected items drag all, unselected drag one. - Add settings copy describing current platform defaults and drag interception. - Rework README for public audience, including Bun build commands and debugging tips. - Add fallback for missing drag icon, using a tiny embedded image on macOS. - Remove original hand‑written main.js test script. * docs(readme): rewrite and update installation, usage, and build instructions - Clarify plugin purpose and usage - Update build commands to use Bun - Add platform notes and modifier key details - Improve formatting and consistency * refactor(main.js): add base64 icon fallback and update modifier key text * feat(main.ts): add fallback drag icon for macOS and improve icon handling * docs(changelog): add minAppVersion validation to release script abort condition * refactor(release.mjs): validate minAppVersion and use it in versions.json
3.8 KiB
Drag Out
Drag files from Obsidian's file explorer to other apps using native OS
drag-and-drop instead of dropping an obsidian:// URL.
This is useful for browser upload fields, email attachments, chat apps, file managers, and other places that expect an actual file from your filesystem.
Status: experimental, desktop only. Tested primarily on Windows so far; macOS and Linux feedback is welcome.
What It Does
Obsidian's file tree is a virtual UI. By default, dragging a note out of the
file tree gives other apps a link like obsidian://open?vault=Vault&file=Note.md
instead of the file itself.
Drag Out intercepts file-tree drags when your configured modifier key is held
and uses Electron's webContents.startDrag API to expose the real on-disk file
path. Normal Obsidian drag behavior is left alone when the modifier is not held.
Installation
Drag Out is not in the Obsidian community plugin marketplace yet. To install it manually:
- Download the release assets:
main.jsandmanifest.json. If the release includesicon.png, download that too. - Open your vault folder.
- Create this folder if it does not already exist:
.obsidian/plugins/drag-out/
- Put the downloaded files in that folder.
- In Obsidian, go to Settings > Community plugins > Installed plugins, refresh the plugin list, and enable Drag Out.
If Restricted Mode is on, Obsidian will ask you to turn it off before enabling community plugins.
Usage
Hold the modifier key while dragging a file or folder from Obsidian's left sidebar file explorer to another app.
The default modifier is:
- Ctrl on Windows and Linux
- Option / Alt on macOS
You can change the modifier in Settings > Drag Out. Available options are Ctrl/Cmd, Alt/Option, Shift, or None.
Multi-select is supported: select multiple files in Obsidian's file explorer, then modifier-drag one of the selected files. If you drag an unselected file while other files are selected, only the file you dragged is sent.
Why A Modifier Key?
Electron's external drag API takes over the current drag operation. That means Obsidian's own file-tree drag behavior, such as moving notes between folders, cannot run during the same drag.
Using a modifier keeps normal Obsidian drags unchanged. If you always want file drags to go to external apps, set the modifier to None in the plugin settings.
Platform Notes
- Windows: tested most heavily. Holding the modifier while dragging starts an external file drag, so Obsidian's internal drop targets will not respond during that drag. This is related to Electron's external drag behavior (Electron #7118).
- macOS: expected to work, but needs more real-world testing. The default modifier is Option/Alt to avoid conflicting with common Cmd interactions.
- Linux: expected to work where Obsidian's Electron drag API is available, but currently less tested than Windows.
- Mobile: not supported. The plugin is marked
isDesktopOnly. - Cloud placeholders: files that are not hydrated locally yet, such as OneDrive placeholders, may need to download before the target app can use them.
Building From Source
This repo uses Bun for its scripts.
bun install
bun run build
For development watch mode:
bun run dev
The build reads main.ts and writes the bundled plugin entrypoint to
main.js. manifest.json is maintained separately.
Debugging
Enable Debug logging in the plugin settings, then open Obsidian's developer
console with Ctrl+Shift+I and try a drag. A successful external drag logs
the resolved filesystem paths.
If you see Drag Out: could not access Electron's webContents, please report
your Obsidian version, operating system, and whether you installed from a
release or built from source.
License
MIT