[backport cloud/1.32] Feat: Show Progress Text on Vue Nodes, Markdown for Preview as Text (#6858)

Backport of #6805 to `cloud/1.32`

Automatically created by backport workflow.

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-6858-backport-cloud-1-32-Feat-Show-Progress-Text-on-Vue-Nodes-Markdown-for-Preview-as-Text-2b46d73d36508139bdd1e2eaf77bf8a9)
by [Unito](https://www.unito.io)

Co-authored-by: Alexander Brown <drjkl@comfy.org>
This commit is contained in:
Comfy Org PR Bot
2025-11-24 04:20:26 +09:00
committed by GitHub
parent 66509b81c4
commit 4d7369b97d
5 changed files with 20 additions and 12 deletions

View File

@@ -17,10 +17,10 @@ useExtensionService().registerExtension({
nodeType.prototype.onNodeCreated = function () { nodeType.prototype.onNodeCreated = function () {
onNodeCreated ? onNodeCreated.apply(this, []) : undefined onNodeCreated ? onNodeCreated.apply(this, []) : undefined
const showValueWidget = ComfyWidgets['STRING']( const showValueWidget = ComfyWidgets['MARKDOWN'](
this, this,
'preview', 'preview',
['STRING', { multiline: true }], ['MARKDOWN', {}],
app app
).widget as DOMWidget<HTMLTextAreaElement, string> ).widget as DOMWidget<HTMLTextAreaElement, string>

View File

@@ -57,7 +57,7 @@ const renderedHtml = computed(() => {
// Methods // Methods
const startEditing = async () => { const startEditing = async () => {
if (isEditing.value) return if (isEditing.value || widget.options?.read_only) return
isEditing.value = true isEditing.value = true
await nextTick() await nextTick()

View File

@@ -6,6 +6,7 @@ import type { InputSpec } from '@/schemas/nodeDef/nodeDefSchemaV2'
import { ComponentWidgetImpl, addWidget } from '@/scripts/domWidget' import { ComponentWidgetImpl, addWidget } from '@/scripts/domWidget'
import type { ComponentWidgetStandardProps } from '@/scripts/domWidget' import type { ComponentWidgetStandardProps } from '@/scripts/domWidget'
import type { ComfyWidgetConstructorV2 } from '@/scripts/widgets' import type { ComfyWidgetConstructorV2 } from '@/scripts/widgets'
import type { IBaseWidget } from '@/lib/litegraph/src/types/widgets'
type TextPreviewCustomProps = Omit< type TextPreviewCustomProps = Omit<
InstanceType<typeof TextPreviewWidget>['$props'], InstanceType<typeof TextPreviewWidget>['$props'],
@@ -14,15 +15,15 @@ type TextPreviewCustomProps = Omit<
const PADDING = 16 const PADDING = 16
export const useTextPreviewWidget = ( export function useTextPreviewWidget(
options: { options: {
minHeight?: number minHeight?: number
} = {} } = {}
) => { ): ComfyWidgetConstructorV2 {
const widgetConstructor: ComfyWidgetConstructorV2 = ( function widgetConstructor(
node: LGraphNode, node: LGraphNode,
inputSpec: InputSpec inputSpec: InputSpec
) => { ): IBaseWidget {
const widgetValue = ref<string>('') const widgetValue = ref<string>('')
const widget = new ComponentWidgetImpl< const widget = new ComponentWidgetImpl<
string | object, string | object,
@@ -41,8 +42,10 @@ export const useTextPreviewWidget = (
widgetValue.value = typeof value === 'string' ? value : String(value) widgetValue.value = typeof value === 'string' ? value : String(value)
}, },
getMinHeight: () => options.minHeight ?? 42 + PADDING, getMinHeight: () => options.minHeight ?? 42 + PADDING,
serialize: false serialize: false,
} read_only: true
},
type: inputSpec.type
}) })
addWidget(node, widget) addWidget(node, widget)
return widget return widget

View File

@@ -134,7 +134,11 @@ const coreWidgetDefinitions: Array<[string, WidgetDefinition]> = [
], ],
[ [
'markdown', 'markdown',
{ component: WidgetMarkdown, aliases: ['MARKDOWN'], essential: false } {
component: WidgetMarkdown,
aliases: ['MARKDOWN', 'progressText'],
essential: false
}
], ],
['legacy', { component: WidgetLegacy, aliases: [], essential: true }], ['legacy', { component: WidgetLegacy, aliases: [], essential: true }],
[ [

View File

@@ -303,10 +303,11 @@ export class ComponentWidgetImpl<
inputSpec: InputSpec inputSpec: InputSpec
props?: P props?: P
options: DOMWidgetOptions<V> options: DOMWidgetOptions<V>
type?: string
}) { }) {
super({ super({
...obj, type: 'custom',
type: 'custom' ...obj
}) })
this.component = obj.component this.component = obj.component
this.inputSpec = obj.inputSpec this.inputSpec = obj.inputSpec