diff --git a/src/composables/widgets/useStringWidget.ts b/src/composables/widgets/useStringWidget.ts index c10fed32f..57ea8b130 100644 --- a/src/composables/widgets/useStringWidget.ts +++ b/src/composables/widgets/useStringWidget.ts @@ -1,6 +1,6 @@ import type { IWidget, LGraphNode } from '@comfyorg/litegraph' -import { type InputSpec } from '@/schemas/nodeDefSchema' +import { type InputSpec, isStringInputSpec } from '@/schemas/nodeDefSchema' import type { ComfyWidgetConstructor } from '@/scripts/widgets' import { useSettingStore } from '@/stores/settingStore' import type { ComfyApp } from '@/types' @@ -64,6 +64,10 @@ export const useStringWidget = () => { inputData: InputSpec, app: ComfyApp ) => { + if (!isStringInputSpec(inputData)) { + throw new Error(`Invalid input data: ${inputData}`) + } + const inputOptions = inputData[1] ?? {} const defaultVal = inputOptions.default ?? '' const multiline = inputOptions.multiline diff --git a/src/extensions/core/noteNode.ts b/src/extensions/core/noteNode.ts index c310660ec..bd4a74613 100644 --- a/src/extensions/core/noteNode.ts +++ b/src/extensions/core/noteNode.ts @@ -26,10 +26,9 @@ app.registerExtension({ this.properties = { text: '' } } ComfyWidgets.STRING( - // Should we extends LGraphNode? Yesss this, - '', - ['', { default: this.properties.text, multiline: true }], + 'text', + ['STRING', { default: this.properties.text, multiline: true }], app ) @@ -66,8 +65,8 @@ app.registerExtension({ } ComfyWidgets.MARKDOWN( this, - '', - ['', { default: this.properties.text }], + 'text', + ['STRING', { default: this.properties.text }], app )