-
Notifications
You must be signed in to change notification settings - Fork 248
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
copy to clipboard in wasm app #113
Comments
If it's helpful, I'm on macOS Monterey 12.4, and I've tested in Chrome, Safari, and Firefox and see the same behavior in each. |
Hi! Yeah, it's a known issue. It was a limitation on the I imagine that the new |
This should get picked up in bevy if bevyengine/bevy#5953 merges |
...or bevyengine/bevy#5347 or bevyengine/bevy#6086 |
I believe it's something that we can't do yet. While |
Will be in Bevy 0.10: bevyengine/bevy#7304 |
I also have a branch with the fix for bevy 0.9.1 if anyone wants to try it out with without depending on main https://github.com/johanhelsing/bevy/tree/optional_prevent_default |
Heads up that it will cause issues with Enter being treated as E key, though: rust-windowing/winit#2673 |
Is it correct there's no (known) blockers to this issue now ? I guess we have to implement clipboard management through web-sys, as :
eframe, which does not suffer from winit's copypaste problem in egui repository, uses web-sys unstable apis : https://github.com/emilk/egui/blob/9c9a54ce36a39885a21688991e459743127934cf/crates/eframe/src/web/events.rs#L171 We could also consider a bridge to js, similar to https://github.com/gamma-delta/quad-wasmnastics/blob/main/src/clipboard.rs ; but that sounds a bit tedious to set up (multiple languages involved) |
Is there a reason this wouldn't work here? |
I think it could work, but I have to admit the exact data flow is not clear in my mind: Copy✅ I think Paste🔴 My first naïve implementation was through 🚧
From wasm-bindgen examples, it seems I need the canvas object to setup my callback: Looks like we can retrieve canvas either by using a selector expose by bevy ; I'd be more comfortable by retrieving directly from winit though. |
@Vrixyz is there any simple bevy example/code that uses clipboard that's a bit universal? I'm struggling to get clipboard working on iOS devices. |
@miketwenty1 I didn't look into it, but it looks like it can/(will?) be supported by arboard (what bevy_egui uses for non-wasm) 1Password/arboard#103 |
Bevy 0.12 is out now and this still isn't fixed. What is going on? What is blocking it now? |
I think the problem was misdiagnosed. The winit But that is entirely different from programmatic control over the clipboard, which requires using the wasm-bindgen API. The current implementation of clipboard for |
Clipboard is now supported in WASM, thanks everyone |
👋 Hello! I really love this crate, it's provided such an easy path to some of the things I'm working on in a small bevy app I've been working on lately! At the moment I've been working on adding some text to the system clipboard when a button is clicked and when I run the app with
cargo run
it does just that! But in the wasm version, nothing's making it to the clipboard when the button's clicked 🤔It seems like I'm able to reproduce in the bevy_egui_web_showcase app too.
bevy_equi_showcase.mp4
Thanks for taking a look if you're able!
The text was updated successfully, but these errors were encountered: