"tools/git@developer.sourcefind.cn:wangsen/paddle_dbnet.git" did not exist on "6335b0d8425040e46a57564e862ab3d8139c73dd"
Unverified Commit 1b556ea9 authored by missionfloyd's avatar missionfloyd Committed by GitHub
Browse files

Add confirmation for clearing canvas

parent 1718730e
......@@ -115,6 +115,13 @@ function dragElement(dragEl, settings) {
savePos = value;
},
});
settings.addSetting({
id: "Comfy.ConfirmClear",
name: "Require confirmation when clearing workflow",
type: "boolean",
defaultValue: false,
});
function dragMouseDown(e) {
e = e || window.event;
......@@ -510,10 +517,16 @@ export class ComfyUI {
$el("button", { textContent: "Load", onclick: () => fileInput.click() }),
$el("button", { textContent: "Refresh", onclick: () => app.refreshComboInNodes() }),
$el("button", { textContent: "Clear", onclick: () => {
app.clean();
app.graph.clear();
if (localStorage.getItem("Comfy.Settings.Comfy.ConfirmClear") == "false" || confirm("Clear workflow?")) {
app.clean();
app.graph.clear();
}
}}),
$el("button", { textContent: "Load Default", onclick: () => {
if (localStorage.getItem("Comfy.Settings.Comfy.ConfirmClear") == "false" || confirm("Load default workflow?")) {
app.loadGraphData()
}
}}),
$el("button", { textContent: "Load Default", onclick: () => app.loadGraphData() }),
]);
dragElement(this.menuContainer, this.settings);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment