mirror of
https://github.com/logseq/logseq.git
synced 2026-05-02 09:56:31 +00:00
improve(plugin): user types
This commit is contained in:
@@ -4,7 +4,10 @@ import {
|
||||
IAppProxy, IDBProxy,
|
||||
IEditorProxy,
|
||||
ILSPluginUser,
|
||||
LSPluginBaseInfo, LSPluginUserEvents, SlashCommandAction,
|
||||
LSPluginBaseInfo,
|
||||
LSPluginUserEvents,
|
||||
SlashCommandAction,
|
||||
BlockCommandCallback,
|
||||
StyleString,
|
||||
ThemeOptions,
|
||||
UIOptions
|
||||
@@ -31,10 +34,14 @@ const editor: Partial<IEditorProxy> = {
|
||||
registerSlashCommand (
|
||||
this: LSPluginUser,
|
||||
tag: string,
|
||||
actions: Array<SlashCommandAction>
|
||||
actions: BlockCommandCallback | Array<SlashCommandAction>
|
||||
) {
|
||||
debug('Register slash command #', this.baseInfo.id, tag, actions)
|
||||
|
||||
if (typeof actions === 'function') {
|
||||
actions = [['editor/clear-current-slash'], ['editor/hook', actions]]
|
||||
}
|
||||
|
||||
actions = actions.map((it) => {
|
||||
const [tag, ...args] = it
|
||||
|
||||
@@ -73,7 +80,7 @@ const editor: Partial<IEditorProxy> = {
|
||||
registerBlockContextMenu (
|
||||
this: LSPluginUser,
|
||||
tag: string,
|
||||
action: () => void
|
||||
action: BlockCommandCallback
|
||||
): boolean {
|
||||
if (typeof action !== 'function') {
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user