mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-27 01:39:47 +00:00
Rework command menu extension API (#1144)
* Rework command menu API * Update test * Update README * Prevent register other extension's command
This commit is contained in:
16
src/types/comfy.d.ts
vendored
16
src/types/comfy.d.ts
vendored
@@ -14,6 +14,18 @@ export type Widgets = Record<
|
||||
) => { widget?: IWidget; minWidth?: number; minHeight?: number }
|
||||
>
|
||||
|
||||
export type MenuCommandGroup = {
|
||||
/**
|
||||
* The path to the menu group.
|
||||
*/
|
||||
path: string[]
|
||||
/**
|
||||
* Command ids.
|
||||
* Note: Commands must be defined in `commands` array in the extension.
|
||||
*/
|
||||
commands: string[]
|
||||
}
|
||||
|
||||
export interface ComfyExtension {
|
||||
/**
|
||||
* The name of the extension
|
||||
@@ -27,6 +39,10 @@ export interface ComfyExtension {
|
||||
* The keybindings defined by the extension
|
||||
*/
|
||||
keybindings?: Keybinding[]
|
||||
/**
|
||||
* Menu commands to add to the menu bar
|
||||
*/
|
||||
menuCommands?: MenuCommandGroup[]
|
||||
/**
|
||||
* Allows any initialisation, e.g. loading resources. Called after the canvas is created but before nodes are added
|
||||
* @param app The ComfyUI app instance
|
||||
|
||||
Reference in New Issue
Block a user