GeezerVison is showing github.com — fix(desktop): add native clipboard image paste and fix text paste by invarrow · Pull Request #12682 · anomalyco/opencode
Conversation
invarrow
commented
Feb 8, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary
- Add native clipboard image paste support for the desktop app using Tauri's clipboard-manager plugin
- Fix a bug where text paste was broken because the native clipboard image check ran before checking for text
Problem
Fixes #9868 #12686
When pasting text on the desktop app, the handlePaste function was checking for native clipboard images (via platform.readClipboardImage) before checking if there was text on the clipboard. Since OS clipboards can hold multiple formats simultaneously, this caused stale image data to be returned even when the user copied text, resulting in:
- Text paste being skipped entirely
- An old/stale image being pasted instead
Solution
Reordered the paste logic so that:
- Browser-detected images are handled first
- Unsupported file types show a toast
- Plain text is extracted from clipboard
- Only if there's no text, the native Tauri clipboard is checked for images (e.g., screenshots copied outside the browser)
- Text is inserted if present
Changes
packages/app/src/components/prompt-input.tsx: Fixed paste order logic
packages/app/src/context/platform.tsx: Added readClipboardImage to Platform type
packages/desktop/src/index.tsx: Implemented readClipboardImage using Tauri plugin
packages/desktop/package.json: Added @tauri-apps/plugin-clipboard-manager dependency
packages/desktop/src-tauri/capabilities/default.json: Added clipboard-manager:allow-read-image capability
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks for your contribution!
This PR doesn't have a linked issue. All PRs must reference an existing issue.
Please:
- Open an issue describing the bug/feature (if one doesn't exist)
- Add
Fixes #<number> or Closes #<number> to this PR description
See CONTRIBUTING.md for details.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
- Add @tauri-apps/plugin-clipboard-manager for native clipboard access
- Add readClipboardImage platform method to read images via Tauri
- Add clipboard-manager:allow-read-image capability
- Fix handlePaste to check for text before trying native clipboard image
The native clipboard fallback was running before checking for plain text,
causing stale image data to override text paste. Now the fallback only
runs when there's no text on the clipboard.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Rwanbt
pushed a commit
to Rwanbt/unifia
that referenced
this pull request
May 5, 2026
AIALRA-0
pushed a commit
to AIALRA-0/opencode-turn-engine
that referenced
this pull request
Jun 10, 2026
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
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.
|