diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a2d0e8224..6ce2e5e020 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. 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') } }