[API] Return ContextMenu created for connecting link (#944)

Allows further customisation / hooks of the created ContextMenu.
This commit is contained in:
filtered
2025-04-20 18:50:42 +10:00
committed by GitHub
parent b988238155
commit c607c53543

View File

@@ -5510,7 +5510,7 @@ export class LGraphCanvas implements ConnectionColorContext {
return false
}
showConnectionMenu(optPass: Partial<ICreateNodeOptions & { e: MouseEvent }>): void {
showConnectionMenu(optPass: Partial<ICreateNodeOptions & { e: MouseEvent }>): ContextMenu<string> | undefined {
const opts = Object.assign<ICreateNodeOptions & HasShowSearchCallback, ICreateNodeOptions>({
nodeFrom: null,
slotFrom: null,
@@ -5597,6 +5597,8 @@ export class LGraphCanvas implements ConnectionColorContext {
callback: inner_clicked,
})
return menu
// callback
function inner_clicked(v: string | undefined, options: IContextMenuOptions<string, INodeInputSlot | INodeOutputSlot>, e: MouseEvent) {
switch (v) {