-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
refactor(core): add support to multiple webviews on a Tauri window #8280
Conversation
Opened related issue |
Hi @lucasfernog, this is an awesome feature you've been working on. I've been playing around with it, and the only issue I've had is that it completely overlays the main tauri webview, so things can get hidden behind it. It makes things like managing drop downs and headers harder. Is it possible to position this webview so it sits under the main webview, enabling layering things on top? |
What kind of change does this PR introduce?
Does this PR introduce a breaking change?
Checklist
fix: remove a typo, closes #___, #___
)Other information
Currently the Tauri's
Window
type (both the Rust struct and JS class) are actually a mix of thetao
Window and thewry
Webview. In order to support multiple webviews on a given window, we actually have to split those types. This PR makes that change so nowWindowBuilder
andWindow
only exposes the window APIs, and we addedWebviewBuilder
andWebview
.To create a window with a webview attached to it, I've added WindowBuilder::with_webview on the Rust side and WebviewWindow class on the JS side. This reduces the breaking changes on the JS side (which I think it's the most common way of using multiwindow on Tauri).
To add webviews to a window, Window::add_child was added. The API isn't finished yet, so I propose we either hide it for v2 or keep it behind an
unstable
feature flag. Specially the auto resize thing needs more work and configuration.Run
cargo run --example multiwebview
to play with it:Ref #2972 #2709 #2076