fix(desktop): paste images into the new workspace prompt
Description
pasting a screenshot into the dashboard "New Workspace" prompt (the "What do you want to do?" box) did nothing. This adds an optional onPasteFiles hook to the MarkdownEditor that pulls file items off the clipboard, and wires it into the modal so pasted images go to the same attachments.add the paperclip button uses.
Now, a pasted screenshot shows up as an attachment pill, same as picking it from the file dialog. 18 lines, the editor change is gated behind an optional prop so the ~12 other call sites are untouched.
Related Issues
fixes #5282
Type of Change
- Bug fix
- New feature
- Documentation
- Refactor
- Other (please describe):
Testing
take a look at the image below: open the dashboard New Workspace modal, paste a screenshot into "What do you want to do?", it renders as a attachment pill. Created a workspace from it and confirmed the agent received the image and could describe it back.
Screenshots (if applicable)
Additional Notes
consdier making pasted images come in as a native [Image #1] instead of a file ref, but that's a bigger agent-specific change, so I left it as the file-ref path that already works across every agent.
Summary by cubic
Enable pasting images into the dashboard “New Workspace” prompt. Pasted screenshots show as attachment pills and send like files from the paperclip.
- Bug Fixes
- Added optional
onPasteFilesto the Markdown editor to read clipboard files fromDataTransfer.filesandDataTransfer.itemsand de‑dupe. - Wired it in the New Workspace prompt to call
attachments.add(files). - Opt-in only; other editor instances are unchanged.
- Added optional
Summary by CodeRabbit
- New Features
- Added support for pasting files into markdown editors via an optional file-paste handler.
- When files are present in the clipboard, paste is intercepted to add those files directly to the editor’s attachment flow (with duplicates filtered), improving reliability during composition.