Skip to content

Commit 2e784fa

Browse files
committed
优化:关键词找不到组件提示
1 parent c49af15 commit 2e784fa

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

electron/mapi/manager/manager.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,10 @@ export const Manager = {
160160
currentText: '',
161161
}, query)
162162
const actions = await this.listAction(request)
163-
const actionFullNameMap = new Map<string, ActionRecord>()
164-
for (const a of actions) {
165-
actionFullNameMap.set(a.fullName, a)
166-
}
167163
let action: ActionRecord = null
168164
if (typeof keywordsOrAction === 'string') {
169165
const uniqueRemover = new Set<string>()
170-
const results = await this.searchActions(uniqueRemover, actionFullNameMap, {
166+
const results = await this.searchActions(uniqueRemover, actions, {
171167
...query,
172168
keywords: keywordsOrAction,
173169
})

electron/mapi/manager/plugin/event.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,13 @@ export const ManagerPluginEvent = {
427427
currentImage: '',
428428
currentText: '',
429429
}, query)
430-
// console.log('redirect', {keywordsOrAction, query})
431430
const action = await Manager.searchOneAction(keywordsOrAction, query)
431+
console.log('redirect', {keywordsOrAction, query, action})
432432
if (!action) {
433-
return false
433+
ManagerPluginEvent.showToast(context, {
434+
body: '未找到相关操作,请检查关键词或操作名称是否正确',
435+
})
436+
return
434437
}
435438
await Manager.openAction(action)
436439
},

0 commit comments

Comments
 (0)