mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-03 06:47:33 +00:00
Relands "Add support for LiteGraph to convert to classes" (#667)
* Revert "Revert "Add support for LiteGraph to convert to classes (#334)" (#386)"
This reverts commit d607f6c7f7.
* Format
This commit is contained in:
@@ -1,32 +1,32 @@
|
||||
import { LiteGraph, LGraphCanvas } from '@comfyorg/litegraph'
|
||||
import { app } from '../../scripts/app'
|
||||
import { ComfyWidgets } from '../../scripts/widgets'
|
||||
import { LGraphNode } from '@comfyorg/litegraph'
|
||||
// Node that add notes to your project
|
||||
|
||||
app.registerExtension({
|
||||
name: 'Comfy.NoteNode',
|
||||
registerCustomNodes() {
|
||||
class NoteNode {
|
||||
class NoteNode extends LGraphNode {
|
||||
static category: string
|
||||
|
||||
color = LGraphCanvas.node_colors.yellow.color
|
||||
bgcolor = LGraphCanvas.node_colors.yellow.bgcolor
|
||||
groupcolor = LGraphCanvas.node_colors.yellow.groupcolor
|
||||
properties: { text: string }
|
||||
serialize_widgets: boolean
|
||||
isVirtualNode: boolean
|
||||
collapsable: boolean
|
||||
title_mode: number
|
||||
|
||||
constructor() {
|
||||
constructor(title?: string) {
|
||||
super(title)
|
||||
if (!this.properties) {
|
||||
this.properties = { text: '' }
|
||||
}
|
||||
ComfyWidgets.STRING(
|
||||
// @ts-expect-error
|
||||
// Should we extends LGraphNode?
|
||||
// Should we extends LGraphNode? Yesss
|
||||
this,
|
||||
'',
|
||||
// @ts-expect-error
|
||||
['', { default: this.properties.text, multiline: true }],
|
||||
app
|
||||
)
|
||||
@@ -40,7 +40,6 @@ app.registerExtension({
|
||||
|
||||
LiteGraph.registerNodeType(
|
||||
'Note',
|
||||
// @ts-expect-error
|
||||
Object.assign(NoteNode, {
|
||||
title_mode: LiteGraph.NORMAL_TITLE,
|
||||
title: 'Note',
|
||||
|
||||
Reference in New Issue
Block a user