Skip to content

Commit

Permalink
vuejs#2175 hotkeys: alt-O to open selected component in editor
Browse files Browse the repository at this point in the history
  • Loading branch information
d9k committed Jul 17, 2024
1 parent 65022f7 commit f8e9f73
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import StateInspector from '@front/features/inspector/StateInspector.vue'
import EmptyPane from '@front/features/layout/EmptyPane.vue'
import { computed, defineComponent, ref, watch } from 'vue'
import { SharedData, copyToClipboard, getComponentDisplayName } from '@vue-devtools/shared-utils'
import { SharedData, copyToClipboard, getComponentDisplayName, openInEditor } from '@vue-devtools/shared-utils'
import { onKeyDown } from '@front/util/keyboard'
import RenderCode from './RenderCode.vue'
import { useSelectedComponent } from './composable'
Expand Down Expand Up @@ -38,6 +38,14 @@ export default defineComponent({
stateFilterInput.value.focus()
return false
}
if ((['o', 'o', 'щ']).includes(event.key) && event.altKey) {
const file = selectedComponent.data.value?.file
if (file) {
openInEditor(file)
}
return false
}
}, true)
const sameApp = computed(() => selectedComponent.data.value?.id.split(':')[0] === selectedComponentId.value?.split(':')[0])
Expand Down
2 changes: 1 addition & 1 deletion packages/app-frontend/src/locales/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default {
},
ComponentInspector: {
openInEditor: {
tooltip: 'Open <mono><<insert_drive_file>>{{file}}</mono> in editor',
tooltip: '[[{{keys.alt}}]] + [[O]] Open <mono><<insert_drive_file>>{{file}}</mono> in editor',
},
},
EventsHistory: {
Expand Down

0 comments on commit f8e9f73

Please sign in to comment.