This commit is contained in:
pythongosssss 2023-10-22 14:47:05 +01:00
parent 32cdc7161d
commit b440f86618
2 changed files with 42 additions and 1544 deletions

File diff suppressed because it is too large Load Diff

View File

@ -169,44 +169,48 @@ class ManageTemplates extends ComfyDialog {
}), }),
] ]
), ),
$el("div", {}, [ $el(
$el("button", { "div",
textContent: "Export", {},
style: { [
fontSize: "12px", $el("button", {
fontWeight: "normal", textContent: "Export",
}, style: {
onclick: (e) => { fontSize: "12px",
const json = JSON.stringify({ templates: [t] }, null, 2); // convert the data to a JSON string fontWeight: "normal",
const blob = new Blob([json], { type: "application/json" }); },
const url = URL.createObjectURL(blob); onclick: (e) => {
const a = $el("a", { const json = JSON.stringify({templates: [t]}, null, 2); // convert the data to a JSON string
href: url, const blob = new Blob([json], {type: "application/json"});
download: (nameInput.value || t.name) + ".json", const url = URL.createObjectURL(blob);
style: { display: "none" }, const a = $el("a", {
parent: document.body, href: url,
}); download: (nameInput.value || t.name) + ".json",
a.click(); style: {display: "none"},
setTimeout(function () { parent: document.body,
a.remove(); });
window.URL.revokeObjectURL(url); a.click();
}, 0); setTimeout(function () {
}, a.remove();
}), window.URL.revokeObjectURL(url);
$el("button", { }, 0);
textContent: "Delete", },
style: { }),
fontSize: "12px", $el("button", {
color: "red", textContent: "Delete",
fontWeight: "normal", style: {
}, fontSize: "12px",
onclick: (e) => { color: "red",
nameInput.value = ""; fontWeight: "normal",
e.target.parentElement.style.display = "none"; },
e.target.parentElement.previousElementSibling.style.display = "none"; onclick: (e) => {
}, nameInput.value = "";
}), e.target.parentElement.style.display = "none";
]), e.target.parentElement.previousElementSibling.style.display = "none";
},
}),
]
),
]; ];
}) })
) )