You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e08a39d
Browse filesBrowse the repository at this point in the historyBrowse files
feat: insert native file path when dropping or pasting non-image files
Previously, only image files could be attached to the composer. Dropping
or pasting any other file type (e.g. .riv, .csv, .json) silently failed
with an "unsupported file type" error, making it impossible to reference
data or asset files by path. Closes#557.
Implementation
──────────────
contracts/ipc.ts
Added getPathForFile(file) to the DesktopBridge interface.
preload.ts
Exposed webUtils.getPathForFile(file) via contextBridge. Electron's
sandbox blocks the legacy file.path property on File objects; the
webUtils API (available since Electron 32) is the official replacement.
ComposerPromptEditor
Added insertText(text) to ComposerPromptEditorHandle. Uses Lexical's
native selection.insertText() to insert at the real cursor position,
which correctly handles existing @mention nodes. Manipulating the
plain-text snapshot and calling setPrompt() was not an option: Lexical's
editor.update() is async, so a synchronous focusComposer() call after
would read a stale snapshotRef and overwrite the inserted text via
onChange.
ChatView
- COMPOSER_FILE_PATH_SEPARATOR constant replaces the magic " " literal.
- addComposerAttachments(files) is a new unified helper (placed next to
addComposerImages) that partitions files into images and non-images.
Images are handled by the existing addComposerImages path. Non-image
files have their native path resolved via desktopBridge.getPathForFile
(fallback: file.name in non-Electron contexts), auto-quoted when the
path contains spaces, joined by COMPOSER_FILE_PATH_SEPARATOR, and
inserted into the composer via insertText().
- onComposerDrop and onComposerPaste both delegate to
addComposerAttachments, eliminating the duplicated partition logic.
onComposerDrop additionally calls focusComposer() only when no
non-image files were dropped, since insertText() focuses the editor
internally as a prerequisite for obtaining a Lexical selection.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
0 commit comments