Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e1f1cd6ba | ||
|
|
57dd0d9167 | ||
|
|
b2de923440 | ||
|
|
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,54 @@ 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;
|
||||||
|
|
||||||
|
// Wait a bit to ensure all other widgets are created first
|
||||||
|
setTimeout(() => {
|
||||||
|
// Import ComfyWidgets if not available globally
|
||||||
|
const ComfyWidgets = app2.widgets || window.ComfyWidgets;
|
||||||
|
|
||||||
|
// Create widget exactly like rgthree does
|
||||||
|
this.textDisplayWidget = ComfyWidgets["STRING"](
|
||||||
|
this,
|
||||||
|
"displayed_text",
|
||||||
|
["STRING", { multiline: true }],
|
||||||
|
app2
|
||||||
|
).widget;
|
||||||
|
|
||||||
|
// Make it read-only
|
||||||
|
this.textDisplayWidget.inputEl.readOnly = true;
|
||||||
|
|
||||||
|
// Style it
|
||||||
|
this.textDisplayWidget.inputEl.style.fontFamily = "monospace";
|
||||||
|
|
||||||
|
// Ensure it doesn't get serialized
|
||||||
|
this.textDisplayWidget.serializeValue = () => undefined;
|
||||||
|
this.textDisplayWidget.serialize = false;
|
||||||
|
|
||||||
|
// Remove it from widgets_values array if it exists
|
||||||
|
const widgetIndex = this.widgets.indexOf(this.textDisplayWidget);
|
||||||
|
if (widgetIndex > -1 && this.widgets_values) {
|
||||||
|
this.widgets_values.splice(widgetIndex, 1);
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
};
|
||||||
|
|
||||||
|
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];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
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