mirror of
https://github.com/logseq/logseq.git
synced 2026-05-01 09:26:28 +00:00
feat(plugin): support configurable UI api for toolbar action items
This commit is contained in:
@@ -25,7 +25,22 @@ declare global {
|
||||
|
||||
const debug = Debug('LSPlugin:user')
|
||||
|
||||
const app: Partial<IAppProxy> = {}
|
||||
const app: Partial<IAppProxy> = {
|
||||
registerUIItem (
|
||||
type: 'toolbar' | 'page',
|
||||
opts: { key: string, template: string }
|
||||
) {
|
||||
const pid = this.baseInfo.id
|
||||
// opts.key = `${pid}_${opts.key}`
|
||||
|
||||
this.caller?.call(`api:call`, {
|
||||
method: 'register-plugin-ui-item',
|
||||
args: [pid, type, opts]
|
||||
})
|
||||
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
let registeredCmdUid = 0
|
||||
|
||||
@@ -101,7 +116,7 @@ const editor: Partial<IEditorProxy> = {
|
||||
args: [this.baseInfo.id, [{ key, label, type }, ['editor/hook', eventKey]]]
|
||||
})
|
||||
|
||||
return false
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user