26 lines
1.2 KiB
JavaScript
26 lines
1.2 KiB
JavaScript
import { app } from "/scripts/app.js";
|
|
import { ComfyWidgets } from "/scripts/widgets.js";
|
|
let hasShownAlertForUpdatingInt = false;
|
|
|
|
app.registerExtension({
|
|
name: "Primere.PrimereOutputs",
|
|
async beforeRegisterNodeDef(nodeType, nodeData, app) {
|
|
if (nodeData.name === "PrimereAnyOutput" || nodeData.name === "PrimereTextOutput") {
|
|
const onNodeCreated = nodeType.prototype.onNodeCreated;
|
|
nodeType.prototype.onNodeCreated = function () {
|
|
onNodeCreated ? onNodeCreated.apply(this, []) : undefined;
|
|
this.showValueWidget = ComfyWidgets["STRING"](this, "output", ["STRING", { multiline: true }], app).widget;
|
|
this.showValueWidget.inputEl.readOnly = true;
|
|
this.showValueWidget.serializeValue = async (node, index) => {
|
|
node.widgets_values[index] = "";
|
|
return "";
|
|
};
|
|
};
|
|
const onExecuted = nodeType.prototype.onExecuted;
|
|
nodeType.prototype.onExecuted = function (message) {
|
|
onExecuted === null || onExecuted === void 0 ? void 0 : onExecuted.apply(this, [message]);
|
|
this.showValueWidget.value = message.text[0];
|
|
};
|
|
}
|
|
},
|
|
}); |