tauri icon indicating copy to clipboard operation
tauri copied to clipboard

clipboard cant read image and file-url

Open yaojiu19 opened this issue 3 years ago • 6 comments

Is your feature request related to a problem? Please describe. clipboard only read text. cant read image and file-url

Describe the solution you'd like add features to read image and file-url

Describe alternatives you've considered

yaojiu19 avatar Oct 21 '21 10:10 yaojiu19

/upstream tauri-apps/tao

amrbashir avatar Oct 30 '21 06:10 amrbashir

I have created an upstream issue at https://github.com/tauri-apps/tao/issues/232, I will notify you once it is resolved.

tauri-apps[bot] avatar Oct 30 '21 06:10 tauri-apps[bot]

Any progress on this, or potential workarounds that anyone suggests?

It seems that due to Linux's special handling of clipboards, using the JavaScript API for document.onpaste does not work as images don't come through correctly.

I have attempted to implement arboard to no success due to my beginner-level skills in Rust, specifically due to not knowing how to properly capture a paste event. Suggestions online immediate suggest things that would cause concern for memory leaks.

Any direction would be incredibly helpful, thank you!

ryanbarr avatar Jun 18 '22 22:06 ryanbarr

If it helps in the meantime, I created https://crates.io/crates/clipboard_files

It reads file urls from the clipboard, and it does so well on Mac, Windows and Linux. However, it doesn't write file urls, and it neither reads nor writes image data. It would be great to have that, and I'd probably have use for it at some point too..

betamos avatar Jun 19 '22 06:06 betamos

I made a tauri plugin that support both text and image. You could simply import the API methods in JavaScript or TypeScript.

  • https://github.com/CrossCopy/tauri-plugin-clipboard
  • Crate: https://crates.io/crates/tauri-plugin-clipboard
  • NPM Package: https://www.npmjs.com/package/tauri-plugin-clipboard-api?activeTab=readme

A demo app also included in the repo.

HuakunShen avatar Jan 19 '23 23:01 HuakunShen

Sounds like a huge work, there are many things to do. image

mankeheaven avatar May 20 '23 09:05 mankeheaven

https://github.com/CrossCopy/tauri-plugin-clipboard now supports text, image, file, html, RTF and watching.

HuakunShen avatar Apr 14 '24 16:04 HuakunShen

Closing as the official clipboard plugin for v2 now supports reading image, for any missing features please open an issue in https://github.com/tauri-apps/plugins-workspace/issues

amrbashir avatar Apr 15 '24 07:04 amrbashir