diff --git a/browser_tests/interaction.spec.ts b/browser_tests/interaction.spec.ts index a0f1f2d23..c0b3d5ba0 100644 --- a/browser_tests/interaction.spec.ts +++ b/browser_tests/interaction.spec.ts @@ -25,10 +25,8 @@ test.describe('Node Interaction', () => { }) test('Can disconnect/connect edge', async ({ comfyPage }) => { + await comfyPage.setSetting('Comfy.LinkRelease.Action', 'no action') await comfyPage.disconnectEdge() - // Close search menu popped up. - await comfyPage.page.keyboard.press('Escape') - await comfyPage.nextFrame() await expect(comfyPage.canvas).toHaveScreenshot( 'disconnected-edge-with-menu.png' ) diff --git a/browser_tests/nodeSearchBox.spec.ts b/browser_tests/nodeSearchBox.spec.ts index 56a2fb3ca..8f622efda 100644 --- a/browser_tests/nodeSearchBox.spec.ts +++ b/browser_tests/nodeSearchBox.spec.ts @@ -3,22 +3,14 @@ import { comfyPageFixture as test } from './ComfyPage' test.describe('Node search box', () => { test.beforeEach(async ({ comfyPage }) => { - await comfyPage.setSetting( - 'Comfy.NodeSearchBoxImpl.LinkReleaseTrigger', - 'always' - ) + await comfyPage.setSetting('Comfy.LinkRelease.Action', 'search box') + await comfyPage.setSetting('Comfy.LinkRelease.ActionShift', 'search box') + await comfyPage.setSetting('Comfy.NodeSearchBoxImpl', 'default') }) - ;['always', 'hold shift', 'NOT hold shift'].forEach((triggerMode) => { - test(`Can trigger on empty canvas double click (${triggerMode})`, async ({ - comfyPage - }) => { - await comfyPage.setSetting( - 'Comfy.NodeSearchBoxImpl.LinkReleaseTrigger', - triggerMode - ) - await comfyPage.doubleClickCanvas() - await expect(comfyPage.searchBox.input).toHaveCount(1) - }) + + test(`Can trigger on empty canvas double click`, async ({ comfyPage }) => { + await comfyPage.doubleClickCanvas() + await expect(comfyPage.searchBox.input).toHaveCount(1) }) test('Can trigger on link release', async ({ comfyPage }) => { @@ -78,3 +70,18 @@ test.describe('Node search box', () => { ) }) }) + +test.describe('Release context menu', () => { + test.beforeEach(async ({ comfyPage }) => { + await comfyPage.setSetting('Comfy.LinkRelease.Action', 'context menu') + await comfyPage.setSetting('Comfy.LinkRelease.ActionShift', 'search box') + await comfyPage.setSetting('Comfy.NodeSearchBoxImpl', 'default') + }) + + test('Can trigger on link release', async ({ comfyPage }) => { + await comfyPage.disconnectEdge() + await expect(comfyPage.canvas).toHaveScreenshot( + 'link-release-context-menu.png' + ) + }) +}) diff --git a/browser_tests/nodeSearchBox.spec.ts-snapshots/link-release-context-menu-chromium-linux.png b/browser_tests/nodeSearchBox.spec.ts-snapshots/link-release-context-menu-chromium-linux.png new file mode 100644 index 000000000..c62656914 Binary files /dev/null and b/browser_tests/nodeSearchBox.spec.ts-snapshots/link-release-context-menu-chromium-linux.png differ diff --git a/package-lock.json b/package-lock.json index 2393b5ee6..b92351330 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.2.44", "dependencies": { "@atlaskit/pragmatic-drag-and-drop": "^1.2.1", - "@comfyorg/litegraph": "^0.7.59", + "@comfyorg/litegraph": "^0.7.60", "@primevue/themes": "^4.0.0-rc.2", "@vitejs/plugin-vue": "^5.0.5", "@vueuse/core": "^11.0.0", @@ -1883,9 +1883,9 @@ "dev": true }, "node_modules/@comfyorg/litegraph": { - "version": "0.7.59", - "resolved": "https://registry.npmjs.org/@comfyorg/litegraph/-/litegraph-0.7.59.tgz", - "integrity": "sha512-Qy4uRa/16MxvsNubBXs+hOVVXKpmNHiQCg/VanFEv2koYrXi4mf/9zKWNNNukoDgL2aMoFpVkXS5O/TiWzFWbg==", + "version": "0.7.60", + "resolved": "https://registry.npmjs.org/@comfyorg/litegraph/-/litegraph-0.7.60.tgz", + "integrity": "sha512-iWo4CAJDL6Ma1mDboRUp58nDSNriquhC8KgHC9T68jA0+Cjd8YBnN8Nqbvv6VI52RvMGpG5MUBcjYEZs2kys/Q==", "license": "MIT" }, "node_modules/@cspotcode/source-map-support": { diff --git a/package.json b/package.json index a908e9db6..4f74ac305 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ }, "dependencies": { "@atlaskit/pragmatic-drag-and-drop": "^1.2.1", - "@comfyorg/litegraph": "^0.7.59", + "@comfyorg/litegraph": "^0.7.60", "@primevue/themes": "^4.0.0-rc.2", "@vitejs/plugin-vue": "^5.0.5", "@vueuse/core": "^11.0.0", diff --git a/src/components/dialog/content/setting/SettingGroup.vue b/src/components/dialog/content/setting/SettingGroup.vue index effbb6a43..bddd53971 100644 --- a/src/components/dialog/content/setting/SettingGroup.vue +++ b/src/components/dialog/content/setting/SettingGroup.vue @@ -10,6 +10,10 @@
+ {{ setting.name }} - + @@ -18,7 +18,7 @@ import SideToolbar from '@/components/sidebar/SideToolbar.vue' import LiteGraphCanvasSplitterOverlay from '@/components/LiteGraphCanvasSplitterOverlay.vue' import NodeSearchboxPopover from '@/components/searchbox/NodeSearchBoxPopover.vue' import NodeTooltip from '@/components/graph/NodeTooltip.vue' -import { ref, computed, onUnmounted, watch, onMounted, watchEffect } from 'vue' +import { ref, computed, onUnmounted, onMounted, watchEffect } from 'vue' import { app as comfyApp } from '@/scripts/app' import { useSettingStore } from '@/stores/settingStore' import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter' @@ -48,16 +48,6 @@ const canvasStore = useCanvasStore() const betaMenuEnabled = computed( () => settingStore.get('Comfy.UseNewMenu') !== 'Disabled' ) -const nodeSearchEnabled = computed( - () => settingStore.get('Comfy.NodeSearchBoxImpl') === 'default' -) - -watchEffect(() => { - LiteGraph.release_link_on_empty_shows_menu = !nodeSearchEnabled.value - if (canvasStore.canvas) { - canvasStore.canvas.allow_searchbox = !nodeSearchEnabled.value - } -}) watchEffect(() => { const canvasInfoEnabled = settingStore.get('Comfy.Graph.CanvasInfo') diff --git a/src/components/searchbox/NodeSearchBox.vue b/src/components/searchbox/NodeSearchBox.vue index 4e790e468..138e73c17 100644 --- a/src/components/searchbox/NodeSearchBox.vue +++ b/src/components/searchbox/NodeSearchBox.vue @@ -116,15 +116,15 @@ const showIdName = computed(() => settingStore.get('Comfy.NodeSearchBoxImpl.ShowIdName') ) -const props = defineProps({ - filters: { - type: Array - }, - searchLimit: { - type: Number, - default: 64 +const props = withDefaults( + defineProps<{ + filters: FilterAndValue[] + searchLimit: number + }>(), + { + searchLimit: 64 } -}) +) const nodeSearchFilterVisible = ref(false) const inputId = `comfy-vue-node-search-box-input-${Math.random()}` diff --git a/src/components/searchbox/NodeSearchBoxPopover.vue b/src/components/searchbox/NodeSearchBoxPopover.vue index 1b97f42af..bed7019a6 100644 --- a/src/components/searchbox/NodeSearchBoxPopover.vue +++ b/src/components/searchbox/NodeSearchBoxPopover.vue @@ -31,23 +31,21 @@ diff --git a/src/stores/settingStore.ts b/src/stores/settingStore.ts index 2d60fb67b..63353ebda 100644 --- a/src/stores/settingStore.ts +++ b/src/stores/settingStore.ts @@ -10,7 +10,10 @@ import { app } from '@/scripts/app' import { ComfySettingsDialog } from '@/scripts/ui/settings' import { Settings } from '@/types/apiTypes' -import { LinkReleaseTriggerMode } from '@/types/searchBoxTypes' +import { + LinkReleaseTriggerAction, + LinkReleaseTriggerMode +} from '@/types/searchBoxTypes' import { SettingParams } from '@/types/settingTypes' import { buildTree } from '@/utils/treeUtil' import { defineStore } from 'pinia' @@ -83,10 +86,26 @@ export const useSettingStore = defineStore('setting', { id: 'Comfy.NodeSearchBoxImpl.LinkReleaseTrigger', category: ['Comfy', 'Node Search Box', 'LinkReleaseTrigger'], name: 'Trigger on link release', - tooltip: 'Only applies to the default implementation', - type: 'combo', + type: 'hidden', options: Object.values(LinkReleaseTriggerMode), - defaultValue: LinkReleaseTriggerMode.ALWAYS + defaultValue: LinkReleaseTriggerMode.ALWAYS, + deprecated: true + }) + + app.ui.settings.addSetting({ + id: 'Comfy.LinkRelease.Action', + name: 'Action on link release (No modifier)', + type: 'combo', + options: Object.values(LinkReleaseTriggerAction), + defaultValue: LinkReleaseTriggerAction.CONTEXT_MENU + }) + + app.ui.settings.addSetting({ + id: 'Comfy.LinkRelease.ActionShift', + name: 'Action on link release (Shift)', + type: 'combo', + options: Object.values(LinkReleaseTriggerAction), + defaultValue: LinkReleaseTriggerAction.SEARCH_BOX }) app.ui.settings.addSetting({ @@ -219,7 +238,8 @@ export const useSettingStore = defineStore('setting', { id: 'Comfy.NodeLibrary.Bookmarks', name: 'Node library bookmarks with display name (deprecated)', type: 'hidden', - defaultValue: [] + defaultValue: [], + deprecated: true }) app.ui.settings.addSetting({ diff --git a/src/types/apiTypes.ts b/src/types/apiTypes.ts index 74f211e38..4efc5b4e9 100644 --- a/src/types/apiTypes.ts +++ b/src/types/apiTypes.ts @@ -2,6 +2,7 @@ import { ZodType, z } from 'zod' import { zComfyWorkflow, zNodeId } from './comfyWorkflow' import { fromZodError } from 'zod-validation-error' import { colorPalettesSchema } from './colorPalette' +import { LinkReleaseTriggerAction } from './searchBoxTypes' const zNodeType = z.string() const zQueueIndex = z.number() @@ -419,6 +420,10 @@ const zBookmarkCustomization = z.object({ }) export type BookmarkCustomization = z.infer +const zLinkReleaseTriggerAction = z.enum( + Object.values(LinkReleaseTriggerAction) as [string, ...string[]] +) + const zSettings = z.record(z.any()).and( z .object({ @@ -454,6 +459,8 @@ const zSettings = z.record(z.any()).and( 'hold shift', 'NOT hold shift' ]), + 'Comfy.LinkRelease.Action': zLinkReleaseTriggerAction, + 'Comfy.LinkRelease.ActionShift': zLinkReleaseTriggerAction, 'Comfy.NodeSearchBoxImpl.NodePreview': z.boolean(), 'Comfy.NodeSearchBoxImpl': z.enum(['default', 'simple']), 'Comfy.NodeSearchBoxImpl.ShowCategory': z.boolean(), diff --git a/src/types/searchBoxTypes.ts b/src/types/searchBoxTypes.ts index 91855e76c..d80140590 100644 --- a/src/types/searchBoxTypes.ts +++ b/src/types/searchBoxTypes.ts @@ -3,3 +3,9 @@ export enum LinkReleaseTriggerMode { HOLD_SHIFT = 'hold shift', NOT_HOLD_SHIFT = 'NOT hold shift' } + +export enum LinkReleaseTriggerAction { + CONTEXT_MENU = 'context menu', + SEARCH_BOX = 'search box', + NO_ACTION = 'no action' +} diff --git a/src/types/settingTypes.ts b/src/types/settingTypes.ts index 77c3c59c2..34ab85ddd 100644 --- a/src/types/settingTypes.ts +++ b/src/types/settingTypes.ts @@ -44,4 +44,5 @@ export interface SettingParams { // Note: Like id, category value need to be unique. category?: string[] experimental?: boolean + deprecated?: boolean }