Skip to content

Commit 4c01b24

Browse files
authoredNov 5, 2024··
feat: add keyboard shortcut to toggle component inspector (#684)
1 parent 550bcbd commit 4c01b24

File tree

1 file changed

+10
-1
lines changed
  • packages/applet/src/modules/components

1 file changed

+10
-1
lines changed
 

‎packages/applet/src/modules/components/index.vue

+10-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
import { parse } from '@vue/devtools-kit'
99
import { isInChromePanel, isInSeparateWindow, sortByKey } from '@vue/devtools-shared'
1010
import { vTooltip, VueButton, VueDialog, VueInput } from '@vue/devtools-ui'
11-
import { useElementSize, useToggle, watchDebounced } from '@vueuse/core'
11+
import { useElementSize, useEventListener, useToggle, watchDebounced } from '@vueuse/core'
1212
import { flatten, groupBy } from 'lodash-es'
1313
import { Pane, Splitpanes } from 'splitpanes'
1414
import { computed, onUnmounted, ref, watch, watchEffect } from 'vue'
@@ -237,6 +237,15 @@ function cancelInspectComponentInspector() {
237237
rpc.value.cancelInspectComponentInspector()
238238
}
239239
240+
useEventListener('keydown', (event) => {
241+
if ((event.key === 's') && (event.ctrlKey || event.metaKey) && !inspectComponentTipVisible.value) {
242+
inspectComponentInspector()
243+
}
244+
else if (event.key === 'Escape' && inspectComponentTipVisible.value) {
245+
cancelInspectComponentInspector()
246+
}
247+
})
248+
240249
function scrollToComponent() {
241250
rpc.value.scrollToComponent(activeComponentId.value)
242251
}

0 commit comments

Comments
 (0)
Please sign in to comment.