Skip to content

Commit

Permalink
Update test-app web-sys.
Browse files Browse the repository at this point in the history
  • Loading branch information
finnbear committed Aug 13, 2024
1 parent bc33f98 commit 2fcf91d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion test-app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ opt-level = "s"
[dependencies]
yew = { version = "0" }
enum-iterator = "0.7"
web-sys = { version = "0", features = [
web-sys = { version = "0.3.70", features = [
"Clipboard",
"Navigator",
"HtmlInputElement",
Expand Down
13 changes: 6 additions & 7 deletions test-app/src/components/gallery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,12 @@ fn GalleryItem(props: &GalleryItemProps) -> Html {

let onclick = {
let show_copied = show_copied.clone();
let window = window().unwrap();
window.navigator().clipboard().map(|clipboard| {
Callback::from(move |_: MouseEvent| {
log::info!("clicked {:?}", icon_id);
let _ = clipboard.write_text(&format!("{:?}", icon_id));
show_copied.set(true);
})
Callback::from(move |_: MouseEvent| {
log::info!("clicked {:?}", icon_id);
let window = window().unwrap();
let clipboard = window.navigator().clipboard();
let _ = clipboard.write_text(&format!("{:?}", icon_id));
show_copied.set(true);
})
};

Expand Down

0 comments on commit 2fcf91d

Please sign in to comment.