- Implemented a text-based table formatter for batches. - Updated Load CSV node to show a table preview in the workflow. - Added a new Preview Batch node for visualizing any batch data. - Added a JavaScript extension to handle node visualization. - Updated English and Spanish documentation.
28 lines
969 B
JavaScript
28 lines
969 B
JavaScript
import { app } from "/scripts/app.js";
|
|
import { ComfyWidgets } from "/scripts/widgets.js";
|
|
|
|
app.registerExtension({
|
|
name: "SequentialBatcher.DisplayBatch",
|
|
async beforeRegisterNodeDef(nodeType, nodeData, app) {
|
|
if (nodeData.name === "LoadCSV" || nodeData.name === "PreviewBatch") {
|
|
const onExecuted = nodeType.prototype.onExecuted;
|
|
nodeType.prototype.onExecuted = function (message) {
|
|
onExecuted?.apply(this, arguments);
|
|
if (message?.text) {
|
|
const text = message.text[0];
|
|
let widget = this.widgets.find((w) => w.name === "batch_preview");
|
|
if (!widget) {
|
|
widget = ComfyWidgets["STRING"](this, "batch_preview", ["STRING", { multiline: true }], app).widget;
|
|
widget.inputEl.readOnly = true;
|
|
widget.inputEl.style.fontFamily = "monospace";
|
|
widget.inputEl.style.fontSize = "10px";
|
|
widget.inputEl.style.overflowY = "scroll";
|
|
}
|
|
widget.value = text;
|
|
this.onResize?.(this.size);
|
|
}
|
|
};
|
|
}
|
|
}
|
|
});
|