Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94210021e3 | ||
|
|
6d2b918ef1 | ||
|
|
d8b1e88c03 |
@@ -92,7 +92,7 @@ class ComfyDeployOutputText:
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
return {"ui": {"text_file": results}}
|
return {"ui": {"text_file": results, "text": [text]}}
|
||||||
|
|
||||||
|
|
||||||
NODE_CLASS_MAPPINGS = {"ComfyDeployOutputText": ComfyDeployOutputText}
|
NODE_CLASS_MAPPINGS = {"ComfyDeployOutputText": ComfyDeployOutputText}
|
||||||
|
|||||||
@@ -497,6 +497,56 @@ const ext = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async beforeRegisterNodeDef(nodeType, nodeData, app2) {
|
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;
|
const origGetExtraMenuOptions = nodeType.prototype.getExtraMenuOptions;
|
||||||
nodeType.prototype.getExtraMenuOptions = function (_, options) {
|
nodeType.prototype.getExtraMenuOptions = function (_, options) {
|
||||||
const r = origGetExtraMenuOptions
|
const r = origGetExtraMenuOptions
|
||||||
|
|||||||
Reference in New Issue
Block a user