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

feat(windows): Expose webview2 zoom hotkeys from wry #9352

Merged
merged 4 commits into from
Apr 3, 2024

Conversation

Legend-Master
Copy link
Contributor

@Legend-Master Legend-Master commented Apr 3, 2024

Reference: #3310

@Legend-Master Legend-Master marked this pull request as ready for review April 3, 2024 06:12
@Legend-Master Legend-Master requested a review from a team as a code owner April 3, 2024 06:12
@Legend-Master Legend-Master changed the title feat: Expose webview2 zoom hotkeys from wry feat(windows): Expose webview2 zoom hotkeys from wry Apr 3, 2024
Copy link
Member

@amrbashir amrbashir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few documentation nitpicks. You will need to regenerate the schema file.

core/tauri-utils/src/config.rs Outdated Show resolved Hide resolved
core/tauri/src/webview/mod.rs Outdated Show resolved Hide resolved
core/tauri/src/webview/webview_window.rs Outdated Show resolved Hide resolved
tooling/api/src/webview.ts Outdated Show resolved Hide resolved
Legend-Master and others added 2 commits April 3, 2024 23:32
Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
@lucasfernog
Copy link
Member

Can we use WebView::zoom to manually implement this feature on macOS/Linux?

@amrbashir
Copy link
Member

This PR is for only allowing users to enable the builtin one on Webview2, we need another PR to expose WebView::zoom and users can create a UI for it themselves.

@amrbashir
Copy link
Member

hmm actually this doesn't enable any UI, just the hotkeys, maybe we can indeed emulate the behavior on other platforms and also expose WebView::zoom at the same time

@Legend-Master would you like to add that too in this PR?

@Legend-Master
Copy link
Contributor Author

Legend-Master commented Apr 3, 2024

I think it's fine to expose the webview2 one first in this pr (it's in the webview2 api but we don't have a way to use it), and expose zoom function and polyfill for this functionality in another pr

If we want to put them in a single pr, I can take a look tomorrow, but I'm not familiar with WebKit zoom controls (is it the same as Chromium?)

And emulating it would be injecting some JavaScript to the webview?

@amrbashir
Copy link
Member

amrbashir commented Apr 3, 2024

If we want to put them in a single pr, I can take a look tomorrow

let's make them in another PR.

but I'm not familiar with WebKit zoom controls (is it the same as Chromium?)

Yeah should be the same keys, ctrl +/-.

And emulating it would be injecting some JavaScript to the webview?

yeah, take a look at https://github.com/tauri-apps/tauri/blob/36b4c12497fbe636066f4848c6877b3ab6cc892e/core/tauri/src/webview/scripts/toggle-devtools.js

@amrbashir amrbashir merged commit 9273d7b into tauri-apps:dev Apr 3, 2024
30 checks passed
@Legend-Master
Copy link
Contributor Author

Legend-Master commented Apr 4, 2024

Seems like webview2's zoom popup is disabled without a way to getting it back MicrosoftEdge/WebView2Feedback#95 (comment), also the zoom factor is not persisted across page load (reset to 100% on reload/restart), pretty sad that webview2's zoom control is a downgraded version of the browser zoom control 😥

I'll take a look at exposing zoom function now

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

Successfully merging this pull request may close these issues.

None yet

3 participants