Fix not showing stored value

This commit is contained in:
pythongosssss
2024-01-03 18:57:32 +00:00
parent e438a73bdc
commit c2ebb1eccf
+3 -3
View File
@@ -2,14 +2,14 @@ import { app } from "../../../scripts/app.js";
import { ComfyWidgets } from "../../../scripts/widgets.js";
// Displays input text on a node
debugger
app.registerExtension({
name: "pysssss.ShowText",
async beforeRegisterNodeDef(nodeType, nodeData, app) {
if (nodeData.name === "ShowText|pysssss") {
function populate(text) {
if (this.widgets) {
const pos = this.widgets.findIndex((w) => w.name === "text");
const pos = this.widgets.findIndex((w) => w.name === "value");
if (pos !== -1) {
for (let i = pos; i < this.widgets.length; i++) {
this.widgets[i].onRemove?.();
@@ -19,7 +19,7 @@ app.registerExtension({
}
for (const list of text) {
const w = ComfyWidgets["STRING"](this, "text", ["STRING", { multiline: true }], app).widget;
const w = ComfyWidgets["STRING"](this, "value", ["STRING", { multiline: true }], app).widget;
w.inputEl.readOnly = true;
w.inputEl.style.opacity = 0.6;
w.value = list;