Closed Tester-957 closed 2 months ago
I believe this is because the text from step one is not removed from the UI. So it's not a problem with the API. Maybe I can make the example clearer by refreshing all content displayed rather than appending the new clipboard content. If you take a screenshot after step 3 you will see the text, the html and a screenshot.
git pull
the main branch to get the latest commit. https://github.com/CrossCopy/tauri-plugin-clipboard/commit/960e6d90a438bb3606549ccede92027e14bb7042
Not sure if this is what you want.
And in your screenshot has hasHtml
and hasText
both equal to true. Are you on Mac?
For me, after writing sample html, I only got hasHtml == true
And in your screenshot has
hasHtml
andhasText
both equal to true. Are you on Mac?在您的屏幕截图中,hasHtml
和hasText
都等于 true。你在Mac上吗? For me, after writing sample html, I only gothasHtml == true
对我来说,编写示例 html 后,我只得到hasHtml == true
On Windows 11, confirm that it is the content left by the last text
I believe this is because the text from step one is not removed from the UI. So it's not a problem with the API. Maybe I can make the example clearer by refreshing all content displayed rather than appending the new clipboard content. If you take a screenshot after step 3 you will see the text, the html and a screenshot.
git pull
the main branch to get the latest commit. 960e6d9Not sure if this is what you want.
When I copy HTML content on Windows, HTML and text will be triggered at the same time, such as copying code in VSCode. I want to be able to write both HTML and text to the clipboard in the same way. This may be a Windows mechanism that allows multiple types of text to exist in the clipboard.
@Tester-957 I see what you mean. This needs to be added in clipboard-rs. @ChurchTao
Here is my experiment with cilpboard-rs, writing html doesn't update text.
let ctx = ClipboardContext::new().unwrap();
ctx.set_html("<h1>hello</h1>".to_string()).unwrap();
let txt = ctx.get_text().unwrap();
println!("txt: {:?}", txt);
let html = ctx.get_html().unwrap();
println!("html: {:?}", html);
Output:
txt: ""
html: "<h1>hello</h1>"
A writeHtmlAndText()
is added.
A
writeHtmlAndText()
is added. 添加了writeHtmlAndText()
。
Thank you
V: 0.6.7 Tested on Windows 11, the problem still exists @HuakunShen
text is the content I copied last time
Oh looks like the new api only worked on Mac, but not windows.
Text has to go before Html, otherwise it won't work on Windows.
Fixed in https://github.com/CrossCopy/tauri-plugin-clipboard/releases/tag/v0.6.8
Tested on Mac, Win11, and Ubuntu 22.
I found that when using writeHtml, the html will be written to the clipboard, but the text will not be written. I can understand this. But when the text is copied and writeHtml is used again, the onTextUpdate event will be triggered.
Here are my steps:
Expected results: Step 3 should only listen for hasHTML, not the text from Step 1.🕷️
I think you can add a writeHtmlAndText(html,text) api😉