Skip to content

Commit 465bcd2

Browse files
committed
feat: add keyboard shortcut (Alt+Shift+C) to toggle Component Inspector
Closes #1058 - Add Alt(Option)+Shift+C shortcut in overlay to toggle Component Inspector - Add the same shortcut in client (DevTools iframe) via RPC - Show the shortcut in the button tooltips
1 parent eed0958 commit 465bcd2

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

packages/client/src/App.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ watch(devtoolsReady, (v) => {
5151
useEventListener('keydown', (e) => {
5252
if (e.code === 'KeyD' && e.altKey && e.shiftKey)
5353
rpc.value.emit('toggle-panel')
54+
if (e.code === 'KeyC' && e.altKey && e.shiftKey && vueInspectorDetected.value) {
55+
rpc.value.emit('toggle-panel', false)
56+
rpc.value.enableVueInspector()
57+
}
5458
})
5559
5660
watchEffect(() => {

packages/overlay/src/App.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ addEventListener('keyup', (e) => {
8383
}
8484
})
8585
86+
addEventListener('keydown', (e) => {
87+
if (e.code === 'KeyC' && e.altKey && e.shiftKey && vueInspectorSupported.value) {
88+
toggleVueInspector()
89+
}
90+
})
91+
8692
const vueInspectorSupported = computed(() => {
8793
return !!(devtools.ctx.state.vitePluginDetected && vueInspector.value)
8894
})
@@ -117,7 +123,7 @@ const { getIframe } = useIframe(clientUrl, async () => {
117123
<!-- panel -->
118124
<div ref="panelEle" class="vue-devtools__panel" :style="panelStyle" @pointerdown="onPointerDown">
119125
<div
120-
class="vue-devtools__anchor-btn panel-entry-btn" title="Toggle Vue DevTools" aria-label="Toggle devtools panel"
126+
class="vue-devtools__anchor-btn panel-entry-btn" title="Toggle Vue DevTools (Alt+Shift+D)" aria-label="Toggle devtools panel"
121127
:style="panelVisible ? '' : 'filter:saturate(0)'" @click="togglePanelVisible"
122128
>
123129
<svg viewBox="0 0 256 198" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -130,7 +136,7 @@ const { getIframe } = useIframe(clientUrl, async () => {
130136
<div class="vue-devtools__panel-content vue-devtools__panel-divider" />
131137
<div
132138
class="vue-devtools__anchor-btn vue-devtools__panel-content vue-devtools__inspector-button"
133-
title="Toggle Component Inspector"
139+
title="Toggle Component Inspector (Alt+Shift+C)"
134140
:class="{ active: vueInspectorEnabled }"
135141
@click="toggleVueInspector"
136142
>

0 commit comments

Comments
 (0)