-
Notifications
You must be signed in to change notification settings - Fork 15k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: webview zoom level persistence on navigation (#41268)
- Loading branch information
1 parent
16adf2a
commit b0c3534
Showing
4 changed files
with
73 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<html> | ||
|
||
<body> | ||
<webview nodeintegration src="app://host1" id="view" partition="webview-temp" /> | ||
</body> | ||
<script> | ||
const { ipcRenderer, webFrame } = require('electron') | ||
const view = document.getElementById('view') | ||
|
||
let values = { | ||
initialZoomLevel: 0, | ||
switchZoomLevel: 0, | ||
finalZoomLevel: 0, | ||
} | ||
|
||
view.addEventListener('dom-ready', async () => { | ||
view.setZoomLevel(2.0) | ||
values.initialZoomLevel = view.getZoomLevel() | ||
|
||
await view.loadURL('app://host2') | ||
view.setZoomLevel(3.0) | ||
values.switchZoomLevel = view.getZoomLevel() | ||
|
||
await view.loadURL('app://host1') | ||
values.finalZoomLevel = view.getZoomLevel() | ||
|
||
ipcRenderer.send('webview-zoom-persist-level', values) | ||
}) | ||
</script> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters