Add setting to disable double click node title edit (#668)

This commit is contained in:
Chenlei Hu
2024-08-28 13:58:33 -04:00
committed by GitHub
parent 493805d0ee
commit 4e8acf6c77
3 changed files with 16 additions and 1 deletions

View File

@@ -15,6 +15,9 @@ import { LGraphNode } from '@comfyorg/litegraph'
import { ComfyExtension } from '@/types/comfy'
import EditableText from '@/components/common/EditableText.vue'
import { LiteGraph } from '@comfyorg/litegraph'
import { useSettingStore } from '@/stores/settingStore'
const settingStore = useSettingStore()
const showInput = ref(false)
const editedTitle = ref('')
@@ -43,6 +46,10 @@ const extension: ComfyExtension = {
const originalCallback = node.onNodeTitleDblClick
node.onNodeTitleDblClick = function (e: MouseEvent, ...args: any[]) {
if (!settingStore.get('Comfy.Node.DoubleClickTitleToEdit')) {
return
}
currentNode.value = this
editedTitle.value = this.title
showInput.value = true

View File

@@ -252,6 +252,13 @@ export const useSettingStore = defineStore('setting', {
max: 100
}
})
app.ui.settings.addSetting({
id: 'Comfy.Node.DoubleClickTitleToEdit',
name: 'Double click node title to edit',
type: 'boolean',
defaultValue: true
})
},
set<K extends keyof Settings>(key: K, value: Settings[K]) {

View File

@@ -465,7 +465,8 @@ const zSettings = z.record(z.any()).and(
'Comfy.Workflow.SortNodeIdOnSave': z.boolean(),
'Comfy.Queue.ImageFit': z.enum(['contain', 'cover']),
'Comfy.Workflow.ModelDownload.AllowedSources': z.array(z.string()),
'Comfy.Workflow.ModelDownload.AllowedSuffixes': z.array(z.string())
'Comfy.Workflow.ModelDownload.AllowedSuffixes': z.array(z.string()),
'Comfy.Node.DoubleClickTitleToEdit': z.boolean()
})
.optional()
)