Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set_html() doesn't update text. #22

Closed
HuakunShen opened this issue Apr 25, 2024 · 1 comment
Closed

set_html() doesn't update text. #22

HuakunShen opened this issue Apr 25, 2024 · 1 comment

Comments

@HuakunShen
Copy link
Contributor

The problem | 问题描述

Original issue CrossCopy/tauri-plugin-clipboard#28

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>"

Expected Behaviour

get_text() should return some text after set_html().

If I run both set_text() and set_html(), the later command will overwrite the first.

Release version | 版本

0.1.6

Operating system | 操作系统

Mac 14.4.1 + Win11

Logs | 日志

No response

@HuakunShen
Copy link
Contributor Author

Solved with .set()

ctx.set(vec![
    ClipboardContent::Text("hello".to_string()),
    ClipboardContent::Html("<h1>hello</h1>".to_string()),
])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant