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

fix a bug where the webxdc was able to open the dev tools. Also make opening devtools with F12 more reliable. #3387

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
### Changed

### Fixed
- webxdc: fix a bug where the webxdc was able to open the dev tools.
Also make opening devtools with F12 more reliable.

<a id="1_40_2"></a>

Expand Down
15 changes: 9 additions & 6 deletions src/main/deltachat/webxdc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -421,14 +421,17 @@ If you think that's a bug and you need that permission, then please open an issu
callback(permission_handler(permission))
}
)
}
)

ipcMain.handle('webxdc.toggle_dev_tools', async event => {
if (DesktopSettings.state.enableWebxdcDevTools) {
event.sender.toggleDevTools()
webxdc_windows.webContents.on('before-input-event', (event, input) => {
if (input.key.toLowerCase() === 'f12') {
if (DesktopSettings.state.enableWebxdcDevTools) {
webxdc_windows.webContents.toggleDevTools()
event.preventDefault()
}
}
})
}
})
)

ipcMain.handle('webxdc.exitFullscreen', async event => {
const key = Object.keys(open_apps).find(
Expand Down
7 changes: 1 addition & 6 deletions static/webxdc-preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,7 @@
})

const keydown_handler = ev => {
if (ev.key == 'F12') {
ipcRenderer.invoke('webxdc.toggle_dev_tools')
ev.preventDefault()
ev.stopImmediatePropagation()
ev.stopPropagation()
} else if (ev.key == 'Escape') {
if (ev.key == 'Escape') {
ipcRenderer.invoke('webxdc.exitFullscreen')
}
}
Expand Down
Loading