diff --git a/CHANGELOG.md b/CHANGELOG.md index 56e99e5780..dc31f74429 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/src/main/deltachat/webxdc.ts b/src/main/deltachat/webxdc.ts index 8d0d6a68cf..4f4b437525 100644 --- a/src/main/deltachat/webxdc.ts +++ b/src/main/deltachat/webxdc.ts @@ -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( diff --git a/static/webxdc-preload.js b/static/webxdc-preload.js index 145816f119..2bfd64df34 100644 --- a/static/webxdc-preload.js +++ b/static/webxdc-preload.js @@ -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') } }