Files
Bjornulf_custom_nodes/web/js/character_description.js.txt
justumen 74f801d62a ...
2024-11-02 18:41:13 +01:00

35 lines
1.3 KiB
Plaintext

import { app } from "../../../scripts/app.js";
console.log("Bjornulf.CharacterDescriptionGenerator extension loaded");
app.registerExtension({
name: "Bjornulf.CharacterDescriptionGenerator",
async nodeCreated(node) {
console.log("nodeCreated called for", node.comfyClass);
if (node.comfyClass === "Bjornulf_CharacterDescriptionGenerator") {
console.log("Creating custom UI for Bjornulf_CharacterDescriptionGenerator");
// Create a simple text element instead of an image
const textElement = document.createElement("div");
textElement.textContent = "Custom UI Test";
textElement.style.padding = "10px";
textElement.style.backgroundColor = "red";
textElement.style.color = "white";
textElement.style.margin = "10px";
// Add the text element to the node's DOM
node.widgets.push({
type: "html",
name: "customUI",
element: textElement
});
console.log("Custom UI element added");
// Ensure the node is redrawn to show the new widget
node.setSize([node.size[0], node.size[1] + 50]);
console.log("Node size adjusted");
}
}
});