From 9def62c3de054daa0bb102fe5cf177d8aca2f1b8 Mon Sep 17 00:00:00 2001 From: pythongosssss <125205205+pythongosssss@users.noreply.github.com> Date: Wed, 3 Jan 2024 20:00:25 +0000 Subject: [PATCH] better fix maybe --- web/js/showText.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/web/js/showText.js b/web/js/showText.js index 110ba05..62da82e 100644 --- a/web/js/showText.js +++ b/web/js/showText.js @@ -8,17 +8,18 @@ app.registerExtension({ if (nodeData.name === "ShowText|pysssss") { function populate(text) { if (this.widgets) { - 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?.(); - } - this.widgets.length = pos; + for (let i = 1; i < this.widgets.length; i++) { + this.widgets[i].onRemove?.(); } + this.widgets.length = 1; } - for (const list of text) { - const w = ComfyWidgets["STRING"](this, "value", ["STRING", { multiline: true }], app).widget; + const v = [...text]; + if (!v[0]) { + v.shift(); + } + for (const list of v) { + const w = ComfyWidgets["STRING"](this, "text", ["STRING", { multiline: true }], app).widget; w.inputEl.readOnly = true; w.inputEl.style.opacity = 0.6; w.value = list;