Skip to content

Commit

Permalink
feat: 脚本列表自动聚焦当前脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
ZiuChen committed Jan 20, 2024
1 parent 797e48c commit ff9c5cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/common/monaco/addActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ export function addActions(
id: 'quickInput',
label: 'Quick Input',
contextMenuGroupId: 'buildin-action',
run: (editor, { list, callback }) => {
run: (editor, { list, callback, options }) => {
editor.trigger('', quickInputCommand!, (quickInput: any) => {
quickInput.pick(list).then((selected?: any) => {
quickInput.pick(list, options).then((selected?: any) => {
callback(selected)
})
})
Expand Down
3 changes: 3 additions & 0 deletions src/views/Runner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ function handleEditorAction(action: EditorAction) {
editorRef.value?.editor?.focus()
editorRef.value?.editor?.trigger('', 'quickInput', {
list,
options: {
activeItem: list[list.findIndex((item) => item.id === store.id)]
},
callback: (selected?: (typeof list)[0]) => {
if (selected) {
useCodeStore().loadCode(selected.id)
Expand Down

0 comments on commit ff9c5cd

Please sign in to comment.