CrossCopy / tauri-plugin-clipboard

A Tauri clipboard plugin with text, files, html, RTF, and image support. Clipboard content update monitoring is also supported.
https://crosscopy.github.io/tauri-plugin-clipboard/
MIT License
122 stars 6 forks source link

This plug-in is great, but it seems that it cannot read and write win11 clipboard images, but it can monitor hasImage #21

Closed Tester-957 closed 2 months ago

Tester-957 commented 2 months ago

Latest examples used

image

HuakunShen commented 2 months ago

I just checked on Win11. The problem indeed exists. It comes from an upstream library. clipboard-rs

@ChurchTao Can you take a quick look? I also get The image format could not be determined on Win11 when I run the example code in clipboard-rs repo.

ChurchTao commented 2 months ago

@Tester-957 My bad, it will be fixed soon. https://github.com/ChurchTao/clipboard-rs/pull/15

HuakunShen commented 2 months ago

@Tester-957 Fixed in v0.6.2. @ChurchTao Thank you!

Tester-957 commented 2 months ago

@Tester-957在 v0.6.2 中修复。 @ChurchTao谢谢你! 我发现 The new version fixes the problem of reading the clipboard, but writing pictures to the clipboard still fails. In the example, click the Write Image (Base64) or Write Image (Binary) buttons to read them in the example interface. This image cannot be pasted in third-party applications such as WeChat or the drawing software that comes with win11. image

Tester-957 commented 2 months ago

Thank you very much for your help 🌹. Today I also tried to use the examples in MAC OS and found a small problem: when I used the "Feishu" office software and used its screen cutting function, the cut screen image could not be monitored by the examples (hasImage:false ) Others are also “false”. I'll test other software tomorrow to see if this problem exists (can provide more information if needed).

HuakunShen commented 2 months ago

@Tester-957 Confirmed the Feishu screenshot problem on Mac, Win11 and Ubuntu22. Same problem on Mac, but not on Win11 or Ubuntu22. Also tested WeChat on MacOS. WeChat's screenshots could be read by clipboard-rs.

Note: screenshot written by Feishu could be read by https://crates.io/crates/arboard. We may need to look at the difference between Arboard and clipboard-rs.

Also confirmed the Windows image pasting problem.

HuakunShen commented 2 months ago

Feishu clipboard image bug located.

Here is the available format for a regular screenshot: ["public.png", "Apple PNG pasteboard type", "public.tiff", "NeXT TIFF v4.0 pasteboard type"]

Here is the available format for a Feishu screenshot ["public.tiff", "NeXT TIFF v4.0 pasteboard type"]

clipboard.dataForType(NSPasteboardTypeTIFF) will return screenshots from Feishu. TIFF is supported by both regular screenshot and Feishu screenshot (verified), so you could simply replace NSPasteboardTypePNG with NSPasteboardTypeTIFF However, it might be prudent to handle both TIFF and PNG formats for has() and get_image(), ensuring compatibility across different scenarios. Supporting both formats is a safer approach. @ChurchTao

ChurchTao commented 2 months ago

@Tester-957 @HuakunShen My bad again, new version released. https://github.com/ChurchTao/clipboard-rs/releases/tag/v0.1.6

HuakunShen commented 2 months ago

Mac's TIFF support and Windows image paste bug fixed in v0.6.3 https://github.com/CrossCopy/tauri-plugin-clipboard/releases/tag/v0.6.3

@Tester-957 Let us know if you found other bugs

Tester-957 commented 2 months ago

@HuakunShen During use, I found a possible performance problem🤔. When using the API to read the Image or using the listener, I found that when the image is large, the main process will be blocked. This is the blocking time-consuming situation I debugged. It can happen in rust layer.I tried to copy a 4k picture, but the interface was blocked for about 7 seconds and became inoperable. image

HuakunShen commented 2 months ago

@Tester-957 Thank you for mentioning. Addressed in https://github.com/CrossCopy/tauri-plugin-clipboard/issues/25 In release mode it should be much faster.

You can open a new issue for a new bug. Otherwise I might miss your message in this closed issue.

Tester-957 commented 2 months ago

@Tester-957 Thank you for mentioning. Addressed in #25谢谢你的提及。已解决 #25 In release mode it should be much faster. 在发布模式下它应该快得多。

You can open a new issue for a new bug. Otherwise I might miss your message in this closed issue.您可以为新错误打开一个新问题。否则我可能会错过你在这个已关闭问题中的留言。

🆗,Thank you!