Compare commits

...
Author SHA1 Message Date
KarrixLee 94210021e3 tweaj 2025-06-28 00:41:05 +08:00
KarrixLee 6d2b918ef1 tweak 2025-06-28 00:27:00 +08:00
KarrixLee d8b1e88c03 hi 2025-06-28 00:23:25 +08:00
2 changed files with 51 additions and 1 deletions
+1 -1
View File
@@ -92,7 +92,7 @@ class ComfyDeployOutputText:
}
)
return {"ui": {"text_file": results}}
return {"ui": {"text_file": results, "text": [text]}}
NODE_CLASS_MAPPINGS = {"ComfyDeployOutputText": ComfyDeployOutputText}
+50
View File
@@ -497,6 +497,56 @@ const ext = {
},
async beforeRegisterNodeDef(nodeType, nodeData, app2) {
// Add text display functionality for ComfyDeployOutputText
if (nodeData.name === "ComfyDeployOutputText") {
const onNodeCreated = nodeType.prototype.onNodeCreated;
nodeType.prototype.onNodeCreated = function () {
onNodeCreated ? onNodeCreated.apply(this, []) : undefined;
// Create a multiline text widget to display the output (similar to rgthree)
this.textDisplayWidget = app.widgets.STRING(
this,
"displayed_text",
["STRING", { multiline: true }],
app2
).widget;
// Style the widget to look like a proper text display box
if (this.textDisplayWidget.inputEl) {
this.textDisplayWidget.inputEl.readOnly = true;
this.textDisplayWidget.inputEl.style.backgroundColor =
"var(--comfy-input-bg)";
this.textDisplayWidget.inputEl.style.border =
"1px solid var(--border-color)";
this.textDisplayWidget.inputEl.style.color = "var(--input-text)";
this.textDisplayWidget.inputEl.style.fontFamily = "monospace";
this.textDisplayWidget.inputEl.style.fontSize = "12px";
this.textDisplayWidget.inputEl.style.minHeight = "100px";
this.textDisplayWidget.inputEl.style.resize = "vertical";
this.textDisplayWidget.inputEl.style.padding = "8px";
this.textDisplayWidget.inputEl.style.whiteSpace = "pre-wrap";
this.textDisplayWidget.inputEl.style.wordWrap = "break-word";
}
// Override the serialize function to not save the display value
this.textDisplayWidget.serializeValue = () => "";
};
const onExecuted = nodeType.prototype.onExecuted;
nodeType.prototype.onExecuted = function (message) {
onExecuted?.apply(this, [message]);
// Display the text output on the node
if (message.text && message.text.length > 0 && this.textDisplayWidget) {
this.textDisplayWidget.value = message.text[0];
// Resize the node to fit the content
this.setSize(this.computeSize());
app.graph.setDirtyCanvas(true);
}
};
}
const origGetExtraMenuOptions = nodeType.prototype.getExtraMenuOptions;
nodeType.prototype.getExtraMenuOptions = function (_, options) {
const r = origGetExtraMenuOptions