Skip to content

Commit

Permalink
feat: add keyboard shortcut to toggle component inspector (#684)
Browse files Browse the repository at this point in the history
  • Loading branch information
webfansplz authored Nov 5, 2024
1 parent 550bcbd commit 4c01b24
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/applet/src/modules/components/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import { parse } from '@vue/devtools-kit'
import { isInChromePanel, isInSeparateWindow, sortByKey } from '@vue/devtools-shared'
import { vTooltip, VueButton, VueDialog, VueInput } from '@vue/devtools-ui'
import { useElementSize, useToggle, watchDebounced } from '@vueuse/core'
import { useElementSize, useEventListener, useToggle, watchDebounced } from '@vueuse/core'
import { flatten, groupBy } from 'lodash-es'
import { Pane, Splitpanes } from 'splitpanes'
import { computed, onUnmounted, ref, watch, watchEffect } from 'vue'
Expand Down Expand Up @@ -237,6 +237,15 @@ function cancelInspectComponentInspector() {
rpc.value.cancelInspectComponentInspector()
}
useEventListener('keydown', (event) => {
if ((event.key === 's') && (event.ctrlKey || event.metaKey) && !inspectComponentTipVisible.value) {
inspectComponentInspector()
}
else if (event.key === 'Escape' && inspectComponentTipVisible.value) {
cancelInspectComponentInspector()
}
})
function scrollToComponent() {
rpc.value.scrollToComponent(activeComponentId.value)
}
Expand Down

0 comments on commit 4c01b24

Please sign in to comment.