Files
Haoming02-comfyui-node-beau…/js/node_beautify.js
T
2024-07-09 17:21:34 +08:00

26 lines
683 B
JavaScript

import { app } from "../../scripts/app.js";
import { Process } from "./functions.js";
app.ui.settings.addSetting({
id: "beautify.GridSize",
name: "Beautify Grid Size",
type: "number",
defaultValue: 10,
});
app.registerExtension({
name: "Comfy.NodeBeautify",
async setup() {
const menu = document.querySelector(".comfy-menu");
const beautifyButton = document.createElement("button");
beautifyButton.textContent = "Beautify";
beautifyButton.addEventListener("click", () => {
app.loadGraphData(Process(app.graph.serialize()));
});
const refreshButton = document.getElementById("comfy-refresh-button");
menu.insertBefore(beautifyButton, refreshButton);
}
});