Prevent Clear List when Delete All

When delete all was clicked and cancelled it still cleared the drawer, fixed
This commit is contained in:
Silversith 2023-04-08 22:12:00 +02:00
parent 42d6954352
commit 0422274440
2 changed files with 7 additions and 7 deletions

View File

@ -210,9 +210,12 @@ app.registerExtension({
right: "5px",
});
deleteAllButton.onclick = () => {
api.deleteAllImages();
allImages = []
imageList.replaceChildren(menu, resizeHandle);
const confirmDelete = confirm("Are you sure you want to delete all images?");
if (confirmDelete) {
api.deleteAllImages();
allImages = []
imageList.replaceChildren(menu, resizeHandle);
}
};
api.getOutput().then(data => {
try {

View File

@ -118,10 +118,7 @@ class ComfyApi extends EventTarget {
}
async deleteAllImages() {
const confirmDelete = confirm("Are you sure you want to delete all images?");
if (confirmDelete) {
await this.#postItem("delete", { delete: "all" })
}
await this.#postItem("delete", { delete: "all" })
}
async deleteImage(filename) {
await this.#postItem("delete", { delete: filename })