add dev tools toggle to side menu

This commit is contained in:
2025-08-15 14:04:21 +12:00
parent 163d3c7b31
commit 47834020b2
4 changed files with 42 additions and 0 deletions
+19
View File
@@ -843,6 +843,14 @@ window.addEventListener('DOMContentLoaded', () => {
zoomInBtn.addEventListener('click', zoomIn);
zoomOutBtn.addEventListener('click', zoomOut);
// DevTools toggle button
const devtoolsBtn = document.getElementById('devtools-btn');
if (devtoolsBtn && window.electronAPI && window.electronAPI.toggleDevTools) {
devtoolsBtn.addEventListener('click', () => {
window.electronAPI.toggleDevTools();
});
}
// wire up back/forward buttons
const backBtn = document.querySelector('.nav-left button:nth-child(1)');
const forwardBtn = document.querySelector('.nav-left button:nth-child(2)');
@@ -900,6 +908,17 @@ window.addEventListener('DOMContentLoaded', () => {
// });
});
// Global keyboard shortcut for DevTools (Ctrl+Shift+I or F12)
document.addEventListener('keydown', (e) => {
const isMod = (e.ctrlKey || e.metaKey) && e.shiftKey && (e.key === 'I' || e.key === 'i');
if (isMod || e.key === 'F12') {
if (window.electronAPI && window.electronAPI.toggleDevTools) {
window.electronAPI.toggleDevTools();
e.preventDefault();
}
}
});
// zoom helpers
function updateZoomUI() {
const zp = document.getElementById('zoom-percent');