tauri
tauri copied to clipboard
[bug] v2: webview menu not working
Describe the bug
I added a tauri::webview::WebviewBuilder in the main window. However, when I use keyboard shortcuts for copy, select, or paste, they don't work. I checked the tauri::webview::WebviewBuilder methods and couldn't find a menu API. How should I address this issue?
fn main() {
tauri::Builder::default()
.setup(|app| {
let window = tauri::WindowBuilder::new(app.handle(), "main")
.inner_size(800.0, 600.0)
.build()
.expect("Failed to create window");
let win_size = window.inner_size().expect("Failed to get window size");
let webview_builder =
tauri::webview::WebviewBuilder::new("github", tauri::WebviewUrl::App("https://github.com".into()))
.auto_resize()
.initialization_script("console.log('Hello from the initialization script!');");
let _ = window.add_child(webview_builder, tauri::LogicalPosition::new(0, 0), win_size);
Ok(())
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
Reproduction
No response
Expected behavior
No response
Full tauri info output
[✔] Environment
- OS: Mac OS 14.4.1 X64
✔ Xcode Command Line Tools: installed
✔ rustc: 1.77.1 (7cf61ebde 2024-03-27)
✔ cargo: 1.77.1 (e52e36006 2024-03-26)
✔ rustup: 1.27.0 (bbb9276d2 2024-03-08)
✔ Rust toolchain: stable-aarch64-apple-darwin (default)
- node: 18.17.0
- pnpm: 8.15.5
- yarn: 1.22.19
- npm: 9.6.7
- bun: 1.0.36
[-] Packages
- tauri [RUST]: 2.0.0-beta.13
- tauri-build [RUST]: 2.0.0-beta.10
- wry [RUST]: 0.37.0
- tao [RUST]: 0.26.2
- @tauri-apps/api [NPM]: 2.0.0-beta.6
- @tauri-apps/cli [NPM]: 2.0.0-beta.11
[-] App
- build-type: bundle
- CSP: unset
- frontendDist: ../dist
- devUrl: http://localhost:1420/
- framework: React
- bundler: Vite
Stack trace
No response
Additional context
No response
Upgrading Tauri to the latest version (2.0.0-beta.14) causes the above code to throw an error.
let win_size = window.inner_size().expect("Failed to get window size");
thread 'main' panicked at /Users/lencx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-runtime-wry-2.0.0-beta.11/src/lib.rs:4044:36:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
libc++abi: terminating due to uncaught foreign exception