Fix opening search from context menu (#3591)

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
filtered
2025-04-24 07:54:27 +10:00
committed by GitHub
parent 9cf3a0e568
commit 2ef8b7cfd7
2 changed files with 23 additions and 2 deletions

View File

@@ -251,4 +251,17 @@ test.describe('Release context menu', () => {
'link-release-context-menu.png'
)
})
test('Can search and add node from context menu', async ({
comfyPage,
comfyMouse
}) => {
await comfyPage.disconnectEdge()
await comfyMouse.move({ x: 10, y: 10 })
await comfyPage.clickContextMenuItem('Search')
await comfyPage.searchBox.fillAndSelectFirstNode('CLIP Prompt')
await expect(comfyPage.canvas).toHaveScreenshot(
'link-context-menu-search.png'
)
})
})

View File

@@ -158,7 +158,10 @@ const showContextMenu = (e: CanvasPointerEvent) => {
const commonOptions = {
e,
allow_searchbox: true,
showSearchBox: () => showSearchBox(e)
showSearchBox: () => {
cancelResetOnContextClose()
showSearchBox(e)
}
}
const connectionOptions =
toType === 'input'
@@ -200,7 +203,12 @@ const showContextMenu = (e: CanvasPointerEvent) => {
)
// Reset when the context menu is closed
useEventListener(menu.controller.signal, 'abort', reset, options)
const cancelResetOnContextClose = useEventListener(
menu.controller.signal,
'abort',
reset,
options
)
}
// Disable litegraph's default behavior of release link and search box.