e.stopPropagation()}
onmousedown={(e) => e.stopPropagation()}
>
{#if activeTab === "prompt"}
{/if}
{#if activeTab === "generated"}
{#if generatedLoaded}
openViewer(imgs, idx, wid)}
onViewModeChange={(mode) => {
galleryViewMode = mode;
if (node.properties) node.properties.pcrGalleryViewMode = mode;
}}
onRowHeightChange={(h) => {
galleryRowHeight = h;
if (node.properties) node.properties.pcrGalleryRowHeight = h;
}}
onCountChange={(c) => { generatedCount = c; }}
onDeleteImages={async (hashes) => {
const wid = getWorkflowId();
if (!wid) return;
try {
await fetchApi(`/promptchain/workflow/${wid}/clear`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ hashes }),
});
invalidateCache(wid);
galleryImages = await fetchWorkflowImages(wid);
} catch {}
}}
onDeleteFiles={async (hashes) => {
const wid = getWorkflowId();
if (!wid) return;
try {
const toDelete = galleryImages.filter(i => hashes.includes(i.hash));
const paths = toDelete.map(i => i.subfolder ? `${i.subfolder}/${i.filename}` : i.filename);
if (paths.length) {
await fetchApi("/promptchain/browse/delete", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ scope: "output", paths }),
});
}
await fetchApi(`/promptchain/workflow/${wid}/clear`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ hashes }),
});
invalidateCache(wid);
galleryImages = await fetchWorkflowImages(wid);
if (paths.length) {
window.dispatchEvent(new CustomEvent("promptchain:file-deleted", {
detail: { scope: "output", paths },
}));
}
} catch {}
}}
onClearHistory={async (action) => {
const wid = getWorkflowId();
if (!wid) return;
if (action === "clear") {
try {
await fetchApi(`/promptchain/workflow/${wid}/clear`, { method: "POST" });
invalidateCache(wid);
galleryImages = [];
} catch {}
} else {
await reloadGenerated();
}
}}
/>
{/if}
{/if}