Compare commits

...

2 Commits

Author SHA1 Message Date
Alexander Brown
067e630096 Merge branch 'main' into glary/blacklist-litegraph-collapse-expand 2026-05-18 16:59:45 -07:00
Glary-Bot
8499e59347 fix: blacklist duplicate LiteGraph Collapse/Expand entries in node menu
The Vue right-click node menu currently surfaces two collapse entries:
- Vue source: 'Minimize Node' / 'Expand Node' (works)
- LiteGraph source: 'Collapse' / 'Expand' (silently no-op)

The LiteGraph entries silently no-op because the converter callback
wrapper invokes 'LGraphCanvas.onMenuNodeCollapse' without the node
argument it expects. Add the labels to HARD_BLACKLIST so only the
working Vue versions are shown, matching the existing pattern that
already drops other LiteGraph items replaced by Vue equivalents
(Colors, Shapes, Mode, etc.).

Also align CORE_MENU_ITEMS / MENU_ORDER on the post-i18n Vue label
'Expand Node' so the toggled Minimize/Expand pair sorts correctly.
2026-05-06 02:20:06 +00:00
2 changed files with 15 additions and 6 deletions

View File

@@ -175,6 +175,15 @@ describe('contextMenuConverter', () => {
expect(result.find((opt) => opt.label === 'Properties')).toBeUndefined()
})
it.each(['Collapse', 'Expand'])(
'should skip LiteGraph %s in favor of Vue Minimize Node / Expand Node',
(label) => {
const items = [{ content: label, callback: () => {} }]
const result = convertContextMenuToOptions(items, undefined, false)
expect(result.find((opt) => opt.label === label)).toBeUndefined()
}
)
it('should convert basic menu items with content', () => {
const items = [{ content: 'Test Item', callback: () => {} }]
const result = convertContextMenuToOptions(items, undefined, false)

View File

@@ -21,7 +21,9 @@ const HARD_BLACKLIST = new Set([
'Title',
'Mode',
'Properties Panel',
'Copy (Clipspace)'
'Copy (Clipspace)',
'Collapse', // Use 'Minimize Node' / 'Expand Node' instead
'Expand' // Use 'Minimize Node' / 'Expand Node' instead
])
/**
@@ -46,8 +48,7 @@ const CORE_MENU_ITEMS = new Set([
'Frame selection',
'Frame Nodes',
'Minimize Node',
'Expand',
'Collapse',
'Expand Node',
// Info and adjustments
'Node Info',
'Resize',
@@ -231,8 +232,7 @@ const MENU_ORDER: string[] = [
'Frame selection',
'Frame Nodes',
'Minimize Node',
'Expand',
'Collapse',
'Expand Node',
'Resize',
'Clone',
// Section 4: Node properties
@@ -303,7 +303,7 @@ export function buildStructuredMenu(options: MenuOption[]): MenuOption[] {
// Section boundaries based on MENU_ORDER indices
// Section 1: 0-2 (Rename, Copy, Duplicate)
// Section 2: 3-8 (Run Branch, Pin, Unpin, Bypass, Remove Bypass, Mute)
// Section 3: 9-15 (Convert to Subgraph, Frame selection, Minimize Node, Expand, Collapse, Resize, Clone)
// Section 3: 9-15 (Convert to Subgraph, Frame selection, Frame Nodes, Minimize Node, Expand Node, Resize, Clone)
// Section 4: 16-17 (Node Info, Color)
// Section 5: 18+ (Image operations and fallback items)
const getSectionNumber = (index: number): number => {