fix(desktop): add native clipboard image paste and fix text paste#12682
fix(desktop): add native clipboard image paste and fix text paste#12682adamdotdevin merged 1 commit intoanomalyco:devfrom
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: Potential Related PRs FoundBased on the search results, here are PRs that appear related to clipboard and paste handling:
The most closely related PR is #12549, which also addresses desktop clipboard image issues and may be addressing a related or overlapping problem. |
- 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.
29e1fd1 to
fa1f87c
Compare
Summary
Problem
Fixes #9868 #12686
When pasting text on the desktop app, the
handlePastefunction was checking for native clipboard images (viaplatform.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:Solution
Reordered the paste logic so that:
Changes
packages/app/src/components/prompt-input.tsx: Fixed paste order logicpackages/app/src/context/platform.tsx: AddedreadClipboardImageto Platform typepackages/desktop/src/index.tsx: ImplementedreadClipboardImageusing Tauri pluginpackages/desktop/package.json: Added@tauri-apps/plugin-clipboard-managerdependencypackages/desktop/src-tauri/capabilities/default.json: Addedclipboard-manager:allow-read-imagecapability