Skip to content

Commit

Permalink
fix a bug where the webxdc was able to open the dev tools.
Browse files Browse the repository at this point in the history
Also make opening devtools with F12 more reliable.
  • Loading branch information
Simon-Laux committed Sep 7, 2023
1 parent 59cd909 commit f5f073a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
- Offer to copy non-HTTP links to the clipboard instead of trying to open them.

### 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

0 comments on commit f5f073a

Please sign in to comment.