desktop/devtools: habilitar F12/Ctrl+Shift+I e menu de contexto para abrir DevTools
- src-tauri: adiciona comando open_devtools que chama window.open_devtools() - frontend: listeners para F12/Ctrl+Shift+I e botão direito com Ctrl/Shift Facilita depuração de UI no executável Tauri.
This commit is contained in:
parent
087170e321
commit
0b39bcb56c
2 changed files with 31 additions and 1 deletions
|
|
@ -769,3 +769,26 @@ function StatusBadge({ status }: { status: string | null }) {
|
|||
|
||||
const root = document.getElementById("root") || (() => { const el = document.createElement("div"); el.id = "root"; document.body.appendChild(el); return el })()
|
||||
createRoot(root).render(<App />)
|
||||
// DevTools shortcut (F12 / Ctrl+Shift+I) and context menu with modifier
|
||||
useEffect(() => {
|
||||
function onKeyDown(e: KeyboardEvent) {
|
||||
const key = (e.key || '').toLowerCase()
|
||||
if (key === 'f12' || (e.ctrlKey && e.shiftKey && key === 'i')) {
|
||||
invoke('open_devtools').catch(() => {})
|
||||
e.preventDefault()
|
||||
}
|
||||
}
|
||||
function onContextMenu(e: MouseEvent) {
|
||||
// Evita abrir sempre: use Ctrl ou Shift + botão direito para abrir DevTools
|
||||
if (e.ctrlKey || e.shiftKey) {
|
||||
invoke('open_devtools').catch(() => {})
|
||||
e.preventDefault()
|
||||
}
|
||||
}
|
||||
window.addEventListener('keydown', onKeyDown)
|
||||
window.addEventListener('contextmenu', onContextMenu)
|
||||
return () => {
|
||||
window.removeEventListener('keydown', onKeyDown)
|
||||
window.removeEventListener('contextmenu', onContextMenu)
|
||||
}
|
||||
}, [])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue