feat: support file drag-and-drop into terminal nodes#163
Merged
DeadWaveWave merged 1 commit intoDeadWaveWave:mainfrom Apr 17, 2026
Merged
feat: support file drag-and-drop into terminal nodes#163DeadWaveWave merged 1 commit intoDeadWaveWave:mainfrom
DeadWaveWave merged 1 commit intoDeadWaveWave:mainfrom
Conversation
Owner
|
感谢贡献!PR 还需要处理一下文件冲突问题 |
56514c0 to
284e4eb
Compare
Enable dragging files from the system file manager into terminal/agent nodes to paste their absolute paths. This mirrors the behavior of native terminals (GNOME Terminal, iTerm2, etc.) where drag-and-drop inserts the file path at the cursor. Uses Electron's `webUtils.getPathForFile()` (sandbox-safe) to resolve absolute paths, escapes shell-special characters with single-quote wrapping, and delegates to `terminal.paste()` for correct bracketed paste mode handling. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fdc90c0 to
3d83559
Compare
Contributor
Author
|
@DeadWaveWave 文件冲突已经解决,如果有其他问题请随时message,感谢! |
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.
Summary
webUtils.getPathForFile()(sandbox-safe) to resolve file paths, with shell-special character escaping via single-quote wrappingterminal.paste()for correct bracketed paste mode handlingDetails
Problem: In native terminals, dragging a file into the window pastes its path. In OpenCove, dragging files into agent/terminal nodes had no effect — xterm.js does not handle HTML5 drag-and-drop events, and no custom handler existed.
Changes (3 files, ~40 lines):
src/.../TerminalNode.tsxdragover/dropevent listeners on the terminal container DOM elementsrc/app/preload/index.tswebUtils.getPathForFile()viaopencoveApi.filesystemsrc/app/preload/index.d.tsgetPathForFileDesign decisions:
webUtils.getPathForFile()instead ofFile.path— the latter returns empty string in sandbox modeterminal.paste()instead ofptyWriteQueue.enqueue()— automatically handles bracketed paste modestopPropagation()on both events — prevents the canvas-level image import handler from interfering$, backticks, etc.)Test plan
🤖 Generated with Claude Code