Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c50e0dbca6 | ||
|
|
b01a60b03a | ||
|
|
e0b248b02e | ||
|
|
2af0b1d69b | ||
|
|
d31a0592dd | ||
|
|
4f5786744e | ||
|
|
e46da79bbf | ||
|
|
02872fa2a9 | ||
|
|
d18757b77c | ||
|
|
7f0c74aa01 | ||
|
|
832f24e04c | ||
|
|
cfed7ad464 | ||
|
|
a463bbec8a | ||
|
|
a9382dc969 | ||
|
|
cb1823f216 | ||
|
|
fcf31d2f4f | ||
|
|
66df393360 | ||
|
|
eae77b683d | ||
|
|
3852b71e0c | ||
|
|
9c949edc7b | ||
|
|
ae0d068e08 | ||
|
|
16e321d19a | ||
|
|
6bb94886b3 | ||
|
|
5e04a25b23 | ||
|
|
ce58fff869 | ||
|
|
501d34a36d | ||
|
|
dd6652c5fd | ||
|
|
24a0ae5ae8 | ||
|
|
d1d6739764 | ||
|
|
9134a59aa1 | ||
|
|
abbb7866b2 | ||
|
|
914cf661b3 | ||
|
|
34977f26a1 | ||
|
|
0a0fcd580d | ||
|
|
2a6a3fcabb | ||
|
|
0563af7123 | ||
|
|
944fa74601 | ||
|
|
cd8bc7a201 |
+66
@@ -369,6 +369,72 @@ async def delete_file_handler(request):
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
@PromptServer.instance.routes.post("/comfy-sidebar/move-temp-to-output")
|
||||
async def move_temp_to_output_handler(request):
|
||||
try:
|
||||
import shutil
|
||||
data = await request.json()
|
||||
filename = (data.get("filename") or "").strip()
|
||||
subfolder = (data.get("subfolder") or "").strip()
|
||||
folder_type = (data.get("type") or "").strip()
|
||||
|
||||
if not filename or folder_type != "temp":
|
||||
return web.json_response({"error": "Only files from the temp directory can be moved"}, status=400)
|
||||
|
||||
if os.path.basename(filename) != filename or filename in (".", ".."):
|
||||
return web.json_response({"error": "Invalid filename"}, status=400)
|
||||
|
||||
if os.path.splitext(filename)[1].lower() not in {
|
||||
".png", ".jpg", ".jpeg", ".webp", ".gif", ".bmp", ".tif", ".tiff", ".avif"
|
||||
}:
|
||||
return web.json_response({"error": "Only image files can be moved"}, status=400)
|
||||
|
||||
temp_dir = folder_paths.get_temp_directory()
|
||||
output_dir = folder_paths.get_output_directory()
|
||||
source_path, source_root = resolve_existing_path(
|
||||
filename, subfolder, "temp",
|
||||
candidate_roots=[os.path.realpath(temp_dir)], strict=True
|
||||
)
|
||||
|
||||
if not source_path or not os.path.isfile(source_path) or not is_path_safe(source_root, source_path):
|
||||
return web.json_response({"error": "Temp image not found"}, status=404)
|
||||
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
stem, ext = os.path.splitext(filename)
|
||||
destination_name = filename
|
||||
suffix = 1
|
||||
|
||||
# Reserve a unique destination without ever overwriting an existing output.
|
||||
while True:
|
||||
destination_path = os.path.join(output_dir, destination_name)
|
||||
try:
|
||||
fd = os.open(destination_path, os.O_CREAT | os.O_EXCL | os.O_WRONLY, 0o666)
|
||||
os.close(fd)
|
||||
break
|
||||
except FileExistsError:
|
||||
destination_name = f"{stem} ({suffix}){ext}"
|
||||
suffix += 1
|
||||
|
||||
try:
|
||||
shutil.copy2(source_path, destination_path)
|
||||
os.remove(source_path)
|
||||
except Exception:
|
||||
try:
|
||||
os.remove(destination_path)
|
||||
except OSError:
|
||||
pass
|
||||
raise
|
||||
|
||||
return web.json_response({
|
||||
"success": True,
|
||||
"filename": destination_name,
|
||||
"subfolder": "",
|
||||
"type": "output"
|
||||
})
|
||||
except Exception as e:
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
@PromptServer.instance.routes.post("/comfy-sidebar/promote-output")
|
||||
async def promote_output_handler(request):
|
||||
try:
|
||||
|
||||
+87
-2
@@ -3,7 +3,7 @@ import { PromptStatus } from "../core/constants.js";
|
||||
import { t } from "../core/i18n.js";
|
||||
import { store } from "../core/store.js";
|
||||
import { renderCardImages } from "./mediaPreview.js";
|
||||
import { copyImageToClipboard, openFileOrFolder, deleteFileOnServer, findNodeIdForImage, removeImageFromNodeOutputs } from "./mediaActions.js";
|
||||
import { copyImageToClipboard, openFileOrFolder, deleteFileOnServer, moveTempImageToOutput, updateMovedImageReferences, findNodeIdForImage, removeImageFromNodeOutputs } from "./mediaActions.js";
|
||||
import { centerAndSelectCanvasNode } from "../comfy/adapter.js";
|
||||
import { getRunOutputs, extractWorkflowFromPng, isImageFormat, animateCardRemoval, downloadJson, getScrollContainer, attachDeleteConfirmation } from "../utils/utils.js";
|
||||
import { showFullscreenPreview } from "../utils/comparison.js";
|
||||
@@ -120,6 +120,81 @@ export function syncCardButtonVisibility(cardObj, state) {
|
||||
: t("Delete Card");
|
||||
}
|
||||
|
||||
if (cardObj.btnMove) {
|
||||
const canMoveCurrentImage = Boolean(
|
||||
currentImg &&
|
||||
currentImg.type === "temp" &&
|
||||
isImageFormat(currentImg.filename || currentImg.url)
|
||||
);
|
||||
|
||||
if (canMoveCurrentImage) {
|
||||
cardObj.btnMove.style.removeProperty("display");
|
||||
cardObj.btnMove.title = t("Move selected image to Outputs (Ctrl+Click)");
|
||||
cardObj.btnMove.onclick = async (ev) => {
|
||||
ev.stopPropagation();
|
||||
if (!ev.ctrlKey && !ev.metaKey) return;
|
||||
if (cardObj._isMovingTempImage) return;
|
||||
|
||||
const liveState = store.getPrompt(state.pid) || state;
|
||||
const selectedImage = liveState.images?.[cardObj.currentImageIndex || 0];
|
||||
if (!selectedImage || selectedImage.type !== "temp") return;
|
||||
|
||||
cardObj._isMovingTempImage = true;
|
||||
cardObj.btnMove.style.opacity = "0.5";
|
||||
const moved = await moveTempImageToOutput(selectedImage);
|
||||
|
||||
if (moved?.success) {
|
||||
// Update raw node outputs before the selected image object itself is mutated.
|
||||
updateMovedImageReferences(liveState.nodeOutputs, selectedImage, moved);
|
||||
updateMovedImageReferences(liveState.images, selectedImage, moved);
|
||||
store.updatePrompt(liveState.pid, liveState);
|
||||
|
||||
// Keep the already-decoded temp image visible while the new output URL
|
||||
// is preloaded. Only switch the existing media element once the replacement
|
||||
// is ready, so the card never collapses to an empty preview in between.
|
||||
const selectedIndex = cardObj.currentImageIndex || 0;
|
||||
const currentMedia = cardObj.grid.querySelector(".comfy-sidebar-media-wrapper > img");
|
||||
const movedImage = liveState.images?.[selectedIndex];
|
||||
const nextSrc = movedImage
|
||||
? (movedImage.url || (window.location.origin + `/view?filename=${encodeURIComponent(movedImage.filename)}&type=${movedImage.type || "output"}&subfolder=${encodeURIComponent(movedImage.subfolder || "")}${liveState.pid ? `&rand=${encodeURIComponent(liveState.pid)}` : ""}`))
|
||||
: null;
|
||||
const refreshPreview = () => {
|
||||
renderCardImages(cardObj, liveState, (st) => {
|
||||
const scrollEl = getScrollContainer(store.ui.cardStack);
|
||||
if (scrollEl) store.ui.mainQueueScrollTop = scrollEl.scrollTop;
|
||||
store.openBatchSubmenu({
|
||||
pid: st.pid,
|
||||
images: st.images,
|
||||
workflow: st.workflow,
|
||||
nodeOutputs: st.nodeOutputs
|
||||
});
|
||||
});
|
||||
cardObj.lastImagesSignature = `${liveState.status || ""}:${liveState.images.map(img => img.url || img.filename).join("|")}`;
|
||||
syncCardButtonVisibility(cardObj, liveState);
|
||||
};
|
||||
|
||||
if (currentMedia && nextSrc && currentMedia.tagName === "IMG") {
|
||||
const preload = new Image();
|
||||
preload.onload = refreshPreview;
|
||||
preload.onerror = refreshPreview;
|
||||
preload.src = nextSrc;
|
||||
} else {
|
||||
refreshPreview();
|
||||
}
|
||||
showNotification(t("Moved selected image to Outputs."), "success", t("Move to Outputs"));
|
||||
} else {
|
||||
showNotification(t("Failed to move image to Outputs."), "error", t("Move to Outputs"));
|
||||
}
|
||||
|
||||
cardObj._isMovingTempImage = false;
|
||||
cardObj.btnMove.style.opacity = "";
|
||||
};
|
||||
} else {
|
||||
cardObj.btnMove.style.setProperty("display", "none", "important");
|
||||
cardObj.btnMove.onclick = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (cardObj.btnFocus) {
|
||||
const nodeId = (currentImg ? findNodeIdForImage(state, currentImg) : null) || state.activeNodeId;
|
||||
if (nodeId) {
|
||||
@@ -420,6 +495,15 @@ export function getOrCreateCard(state, callbacks = {}) {
|
||||
btnDelLabel.textContent = t("Delete File");
|
||||
btnDel.appendChild(btnDelLabel);
|
||||
|
||||
const btnMove = document.createElement("span");
|
||||
btnMove.className = "pi pi-folder-open comfy-sidebar-card-action-btn comfy-sidebar-btn-move";
|
||||
btnMove.title = t("Move selected image to Outputs (Ctrl+Click)");
|
||||
const btnMoveLabel = document.createElement("span");
|
||||
btnMoveLabel.className = "comfy-sidebar-move-label";
|
||||
btnMoveLabel.textContent = t("Move to Outputs");
|
||||
btnMove.appendChild(btnMoveLabel);
|
||||
btnMove.style.display = "none";
|
||||
|
||||
const leftHoverPanel = document.createElement("div");
|
||||
leftHoverPanel.className = "comfy-sidebar-left-hover-panel";
|
||||
Object.assign(leftHoverPanel.style, {
|
||||
@@ -434,7 +518,7 @@ export function getOrCreateCard(state, callbacks = {}) {
|
||||
leftHoverBtn.className = "pi pi-images comfy-sidebar-card-action-btn";
|
||||
leftHoverBtn.title = t("View all intermediate outputs");
|
||||
|
||||
hoverPanel.append(btnImg, btnJson, btnDel);
|
||||
hoverPanel.append(btnImg, btnJson, btnMove, btnDel);
|
||||
leftHoverPanel.append(btnCopy, btnFocus, leftHoverBtn);
|
||||
|
||||
// Appending grid FIRST ensures overlays (badges, cancel button) naturally render on top
|
||||
@@ -459,6 +543,7 @@ export function getOrCreateCard(state, callbacks = {}) {
|
||||
btnJson,
|
||||
btnDel,
|
||||
btnDelLabel,
|
||||
btnMove,
|
||||
canDeleteFromDisk: true,
|
||||
statusText,
|
||||
firstImgElement: null,
|
||||
|
||||
@@ -77,6 +77,55 @@ export async function deleteFileOnServer(fileItem) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function moveTempImageToOutput(fileItem) {
|
||||
if (!fileItem || !fileItem.filename || fileItem.type !== "temp") return null;
|
||||
try {
|
||||
const res = await fetch("/comfy-sidebar/move-temp-to-output", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
filename: fileItem.filename,
|
||||
subfolder: fileItem.subfolder || "",
|
||||
type: fileItem.type
|
||||
})
|
||||
});
|
||||
if (!res.ok) {
|
||||
const data = await res.json().catch(() => ({}));
|
||||
console.error("Comfy Sidebar: Failed to move temp image", data.error || res.statusText);
|
||||
return null;
|
||||
}
|
||||
return await res.json();
|
||||
} catch (err) {
|
||||
console.error("Comfy Sidebar: Failed to move temp image", err);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export function updateMovedImageReferences(value, oldImage, moved) {
|
||||
const oldFilename = oldImage?.filename;
|
||||
const oldSubfolder = oldImage?.subfolder || "";
|
||||
if (!value || !oldFilename || !moved?.filename) return;
|
||||
|
||||
const visit = (obj) => {
|
||||
if (!obj || typeof obj !== "object") return;
|
||||
if (Array.isArray(obj)) {
|
||||
obj.forEach(visit);
|
||||
return;
|
||||
}
|
||||
if (obj.filename === oldFilename &&
|
||||
(obj.subfolder || "") === oldSubfolder &&
|
||||
(obj.type || "temp") === "temp") {
|
||||
obj.filename = moved.filename;
|
||||
obj.subfolder = moved.subfolder || "";
|
||||
obj.type = moved.type || "output";
|
||||
if (obj.url && !obj.url.startsWith("blob:")) delete obj.url;
|
||||
}
|
||||
Object.values(obj).forEach(visit);
|
||||
};
|
||||
|
||||
visit(value);
|
||||
}
|
||||
|
||||
export function removeImageFromNodeOutputs(nodeOutputs, targetImg) {
|
||||
if (!nodeOutputs || !targetImg || !targetImg.filename) return;
|
||||
|
||||
|
||||
+68
-39
@@ -5,7 +5,6 @@ import { showFullscreenPreview } from "../utils/comparison.js";
|
||||
import { store } from "../core/store.js";
|
||||
import { PromptStatus } from "../core/constants.js";
|
||||
import { t } from "../core/i18n.js";
|
||||
import { deleteHistoryItem } from "../queue/queueService.js";
|
||||
|
||||
export function findWorkflowBackgroundThumbnail(state, randParam = "") {
|
||||
if (!state) return null;
|
||||
@@ -429,6 +428,21 @@ export function renderCardImages(cardObj, state, onNavigateBatch) {
|
||||
|
||||
const idx = cardObj.currentImageIndex;
|
||||
const img = state.images[idx];
|
||||
|
||||
// The Queue's advanced action follows the currently selected batch image.
|
||||
if (cardObj.btnMove) {
|
||||
const canMoveToOutputs = Boolean(
|
||||
img &&
|
||||
img.type === "temp" &&
|
||||
isImageFormat(img.filename || img.url)
|
||||
);
|
||||
if (canMoveToOutputs) {
|
||||
cardObj.btnMove.style.removeProperty("display");
|
||||
} else {
|
||||
cardObj.btnMove.style.setProperty("display", "none", "important");
|
||||
}
|
||||
}
|
||||
|
||||
if (!img) {
|
||||
cardObj.grid.innerHTML = "";
|
||||
cardObj.firstImgElement = null;
|
||||
@@ -467,15 +481,15 @@ export function renderCardImages(cardObj, state, onNavigateBatch) {
|
||||
const existingFile = wrapper.querySelector(".comfy-sidebar-file-wrapper");
|
||||
|
||||
if (existingTopImg) {
|
||||
// Keep the currently rendered frame visible while a replacement source loads.
|
||||
// Clearing src here made every card refresh briefly collapse to an empty preview.
|
||||
if (existingTopImg.tagName === "VIDEO") {
|
||||
existingTopImg.onloadedmetadata = null;
|
||||
existingTopImg.pause();
|
||||
existingTopImg.src = "";
|
||||
existingTopImg.load();
|
||||
} else {
|
||||
existingTopImg.onload = null;
|
||||
existingTopImg.src = "";
|
||||
}
|
||||
existingTopImg.onerror = null;
|
||||
}
|
||||
|
||||
if (is3D) {
|
||||
@@ -554,48 +568,61 @@ export function renderCardImages(cardObj, state, onNavigateBatch) {
|
||||
|
||||
const cardId = cardObj.element?.id || "";
|
||||
|
||||
// 1. If an intermediate output item is missing, remove only this item
|
||||
// Ignore a late error from the previous URL if this media element has
|
||||
// already been pointed at a replacement file (for example after Move).
|
||||
const failedUrl = new URL(src, window.location.origin).href;
|
||||
const activeUrl = mediaEl.src;
|
||||
if (activeUrl && activeUrl !== failedUrl) return;
|
||||
|
||||
// 1. If an intermediate output item is missing, remove only that image.
|
||||
// A node can have several images, so never discard the node's other outputs.
|
||||
if (cardId.startsWith("card-submenu-")) {
|
||||
const parentState = store.getPrompt(state.pid);
|
||||
if (parentState && parentState.nodeOutputs) {
|
||||
if (state.nodeId && parentState.nodeOutputs[state.nodeId]) {
|
||||
delete parentState.nodeOutputs[state.nodeId];
|
||||
} else {
|
||||
removeImageFromNodeOutputs(parentState.nodeOutputs, img);
|
||||
}
|
||||
const missingIndex = state.images?.findIndex(item =>
|
||||
item.filename === img.filename &&
|
||||
(item.subfolder || "") === (img.subfolder || "")
|
||||
) ?? -1;
|
||||
if (missingIndex >= 0) state.images.splice(missingIndex, 1);
|
||||
|
||||
if (parentState?.nodeOutputs) {
|
||||
removeImageFromNodeOutputs(parentState.nodeOutputs, img);
|
||||
store.updatePrompt(parentState.pid, parentState);
|
||||
}
|
||||
cardObj.element?.remove();
|
||||
const remaining = store.ui.cardStack?.querySelectorAll('.comfy-sidebar-card');
|
||||
if (!remaining || remaining.length === 0) {
|
||||
store.closeSubmenu();
|
||||
|
||||
if (state.images?.length > 0) {
|
||||
cardObj.currentImageIndex = Math.min(cardObj.currentImageIndex || 0, state.images.length - 1);
|
||||
renderCardImages(cardObj, state, onNavigateBatch);
|
||||
} else {
|
||||
cardObj.element?.remove();
|
||||
const remaining = store.ui.cardStack?.querySelectorAll('.comfy-sidebar-card');
|
||||
if (!remaining || remaining.length === 0) store.closeSubmenu();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. If a batch item is missing, remove only this item from the batch
|
||||
// 2. If a batch item is missing, remove only this item and keep its history.
|
||||
if (cardId.startsWith("card-batch-")) {
|
||||
const parentPid = state.parentPromptId || state.pid;
|
||||
const batchInfo = store.ui.activeSubmenuBatchImages;
|
||||
const parentPid = state.parentPromptId || batchInfo?.parentPromptId || state.pid;
|
||||
const parentState = store.getPrompt(parentPid);
|
||||
if (Array.isArray(batchInfo?.images)) {
|
||||
const batchIndex = batchInfo.images.findIndex(item =>
|
||||
item.filename === img.filename &&
|
||||
(item.subfolder || "") === (img.subfolder || "")
|
||||
);
|
||||
if (batchIndex >= 0) batchInfo.images.splice(batchIndex, 1);
|
||||
}
|
||||
if (parentState) {
|
||||
if (Array.isArray(parentState.images)) {
|
||||
const idx = parentState.images.findIndex(i => i.filename === img.filename && (i.subfolder || "") === (img.subfolder || ""));
|
||||
if (idx > -1) parentState.images.splice(idx, 1);
|
||||
}
|
||||
if (parentState.nodeOutputs) {
|
||||
removeImageFromNodeOutputs(parentState.nodeOutputs, img);
|
||||
}
|
||||
if ((!parentState.images || parentState.images.length === 0) && parentState.status === PromptStatus.COMPLETED) {
|
||||
deleteHistoryItem(parentPid);
|
||||
} else {
|
||||
store.updatePrompt(parentPid, parentState);
|
||||
}
|
||||
if (parentState.nodeOutputs) removeImageFromNodeOutputs(parentState.nodeOutputs, img);
|
||||
store.updatePrompt(parentPid, parentState);
|
||||
}
|
||||
cardObj.element?.remove();
|
||||
const remaining = store.ui.cardStack?.querySelectorAll('.comfy-sidebar-card');
|
||||
if (!remaining || remaining.length === 0) {
|
||||
store.closeSubmenu();
|
||||
}
|
||||
if (!remaining || remaining.length === 0) store.closeSubmenu();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -612,22 +639,24 @@ export function renderCardImages(cardObj, state, onNavigateBatch) {
|
||||
}
|
||||
|
||||
if (liveState.images && liveState.images.length > 0) {
|
||||
cardObj.currentImageIndex = 0;
|
||||
cardObj.currentImageIndex = Math.min(cardObj.currentImageIndex || 0, liveState.images.length - 1);
|
||||
cardObj.lastImagesSignature = "";
|
||||
store.updatePrompt(liveState.pid, liveState);
|
||||
renderCardImages(cardObj, liveState, onNavigateBatch);
|
||||
return;
|
||||
}
|
||||
|
||||
// If the job is still actively generating/running, keep it
|
||||
if (liveState.status && liveState.status !== PromptStatus.COMPLETED) {
|
||||
cardObj.lastImagesSignature = "";
|
||||
store.updatePrompt(liveState.pid, liveState);
|
||||
return;
|
||||
}
|
||||
|
||||
// Temp image preview was deleted and only intermediate prompt text remains: delete card for good
|
||||
deleteHistoryItem(liveState.pid);
|
||||
cardObj.element?.remove();
|
||||
// Keep the history card even if its file was removed. Missing media should
|
||||
// not erase history or prevent a later run from reusing the same output path.
|
||||
renderCardImages(cardObj, liveState, onNavigateBatch);
|
||||
cardObj.grid.innerHTML = "";
|
||||
cardObj.firstImgElement = null;
|
||||
cardObj.lastImagesSignature = "";
|
||||
cardObj.placeholder.textContent = liveState.texts?.length
|
||||
? liveState.texts.join("\n\n")
|
||||
: t("No Outputs");
|
||||
cardObj.placeholder.style.display = "block";
|
||||
store.updatePrompt(liveState.pid, liveState);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+53
-2
@@ -8,7 +8,7 @@ import { updateSidebarBadge, centerAndSelectCanvasNode } from "../comfy/adapter.
|
||||
import { matchesFilter, getRunOutputs, isImageFormat, animateCardRemoval, getScrollContainer, calculateGridColumns, setupSpotlightTracker, attachDeleteConfirmation } from "../utils/utils.js";
|
||||
import { getSetting } from "../core/settings.js";
|
||||
import { renderCardImages } from "./mediaPreview.js";
|
||||
import { deleteFileOnServer, removeImageFromNodeOutputs, copyImageToClipboard, findNodeIdForImage } from "./mediaActions.js";
|
||||
import { deleteFileOnServer, moveTempImageToOutput, updateMovedImageReferences, removeImageFromNodeOutputs, copyImageToClipboard, findNodeIdForImage } from "./mediaActions.js";
|
||||
import { toggleIgnoreActiveNode } from "../comfy/nodes.js";
|
||||
import { renumberNodesTopologically, showNotification } from "../utils/nodeRenumber.js";
|
||||
|
||||
@@ -804,6 +804,14 @@ export function renderSidebar() {
|
||||
btnDelLabel.textContent = t("Delete File");
|
||||
btnDel.appendChild(btnDelLabel);
|
||||
|
||||
const btnMove = document.createElement("span");
|
||||
btnMove.className = "pi pi-folder-open comfy-sidebar-card-action-btn comfy-sidebar-btn-move";
|
||||
btnMove.title = t("Move selected image to Outputs (Ctrl+Click)");
|
||||
const btnMoveLabel = document.createElement("span");
|
||||
btnMoveLabel.className = "comfy-sidebar-move-label";
|
||||
btnMoveLabel.textContent = t("Move to Outputs");
|
||||
btnMove.appendChild(btnMoveLabel);
|
||||
|
||||
attachDeleteConfirmation(btnDel, {
|
||||
idleTitle: t("Delete node output (Hold Ctrl to delete file from disk)"),
|
||||
confirmTitle: t("Click again to confirm removing output"),
|
||||
@@ -843,7 +851,7 @@ export function renderSidebar() {
|
||||
}
|
||||
});
|
||||
|
||||
hoverPanel.append(btnImg, btnDel);
|
||||
hoverPanel.append(btnImg, btnMove, btnDel);
|
||||
|
||||
const leftHoverPanel = document.createElement("div");
|
||||
leftHoverPanel.className = "comfy-sidebar-left-hover-panel";
|
||||
@@ -898,12 +906,55 @@ export function renderSidebar() {
|
||||
btnCopy,
|
||||
btnFocus,
|
||||
btnDel,
|
||||
btnMove,
|
||||
firstImgElement: null
|
||||
};
|
||||
|
||||
cardPool.set(cardId, cardObj);
|
||||
}
|
||||
|
||||
if (cardObj.btnMove) {
|
||||
const selectedImage = out.images?.[cardObj.currentImageIndex || 0];
|
||||
const canMoveSelectedImage = Boolean(
|
||||
selectedImage &&
|
||||
selectedImage.type === "temp" &&
|
||||
isImageFormat(selectedImage.filename || selectedImage.url)
|
||||
);
|
||||
|
||||
if (canMoveSelectedImage) {
|
||||
cardObj.btnMove.title = t("Move selected image to Outputs (Ctrl+Click)");
|
||||
cardObj.btnMove.onclick = async (ev) => {
|
||||
ev.stopPropagation();
|
||||
if (!ev.ctrlKey && !ev.metaKey) return;
|
||||
if (cardObj._isMovingTempImage) return;
|
||||
|
||||
const liveState = store.getPrompt(st.pid) || st;
|
||||
const imageToMove = out.images?.[cardObj.currentImageIndex || 0];
|
||||
if (!imageToMove || imageToMove.type !== "temp") return;
|
||||
|
||||
cardObj._isMovingTempImage = true;
|
||||
cardObj.btnMove.style.opacity = "0.5";
|
||||
const moved = await moveTempImageToOutput(imageToMove);
|
||||
|
||||
if (moved?.success) {
|
||||
updateMovedImageReferences(liveState.images, imageToMove, moved);
|
||||
updateMovedImageReferences(liveState.nodeOutputs, imageToMove, moved);
|
||||
updateMovedImageReferences(out.images, imageToMove, moved);
|
||||
store.updatePrompt(liveState.pid, liveState);
|
||||
showNotification(t("Moved selected image to Outputs."), "success", t("Move to Outputs"));
|
||||
renderSidebar();
|
||||
} else {
|
||||
showNotification(t("Failed to move image to Outputs."), "error", t("Move to Outputs"));
|
||||
}
|
||||
|
||||
cardObj._isMovingTempImage = false;
|
||||
cardObj.btnMove.style.opacity = "";
|
||||
};
|
||||
} else {
|
||||
cardObj.btnMove.onclick = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (out.images && out.images.length > 0) {
|
||||
cardObj.placeholder.style.display = "none";
|
||||
renderCardImages(cardObj, {
|
||||
|
||||
+25
-1
@@ -160,6 +160,16 @@ export function injectStyles() {
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.comfy-sidebar-move-label {
|
||||
display: inline;
|
||||
margin-left: 5px;
|
||||
font-size: 10px;
|
||||
font-weight: bold;
|
||||
white-space: nowrap;
|
||||
font-family: sans-serif;
|
||||
letter-spacing: 0.3px;
|
||||
}
|
||||
|
||||
/* Delete Confirmation Active State */
|
||||
.comfy-sidebar-card-action-btn.confirm-delete,
|
||||
.comfy-sidebar-card-action-btn.confirm-delete:hover {
|
||||
@@ -177,6 +187,11 @@ export function injectStyles() {
|
||||
border: 1px solid #ef4444 !important;
|
||||
}
|
||||
|
||||
/* Move to Outputs is an advanced Queue action: never show it outside Ctrl mode. */
|
||||
.comfy-sidebar-btn-move {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Dynamic Ctrl Key Hover State */
|
||||
.comfy-sidebar-del-label {
|
||||
display: none;
|
||||
@@ -188,7 +203,7 @@ export function injectStyles() {
|
||||
letter-spacing: 0.3px;
|
||||
}
|
||||
|
||||
body.comfy-sidebar-ctrl-active .comfy-sidebar-card-action-btn:not(.comfy-sidebar-btn-del) {
|
||||
body.comfy-sidebar-ctrl-active .comfy-sidebar-card-action-btn:not(.comfy-sidebar-btn-del):not(.comfy-sidebar-btn-move) {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
@@ -196,6 +211,15 @@ export function injectStyles() {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
body.comfy-sidebar-ctrl-active .comfy-sidebar-btn-move {
|
||||
display: inline-flex !important;
|
||||
background-color: #166534 !important;
|
||||
color: #ffffff !important;
|
||||
border: 1px solid #22c55e !important;
|
||||
width: auto !important;
|
||||
padding: 0 8px !important;
|
||||
}
|
||||
|
||||
body.comfy-sidebar-ctrl-active .comfy-sidebar-btn-del {
|
||||
background-color: #991b1b !important;
|
||||
color: #ffffff !important;
|
||||
|
||||
@@ -129,5 +129,9 @@
|
||||
"Search Gallery (Filename or Prompt)": "البحث في المعرض (اسم الملف أو الموجه)",
|
||||
"Search filenames or prompt metadata...": "البحث في أسماء الملفات أو بيانات الموجه...",
|
||||
"Type to load saved workflow...": "اكتب لتحميل سير عمل محفوظ...",
|
||||
"No matching workflows": "لا توجد مسارات عمل مطابقة"
|
||||
}
|
||||
"No matching workflows": "لا توجد مسارات عمل مطابقة",
|
||||
"Move to Outputs": "نقل إلى المخرجات",
|
||||
"Move selected image to Outputs (Ctrl+Click)": "انقل الصورة المحددة إلى المخرجات (Ctrl+نقرة)",
|
||||
"Moved selected image to Outputs.": "تم نقل الصورة المحددة إلى المخرجات.",
|
||||
"Failed to move image to Outputs.": "تعذر نقل الصورة إلى المخرجات."
|
||||
}
|
||||
|
||||
@@ -129,5 +129,9 @@
|
||||
"Search Gallery (Filename or Prompt)": "Search Gallery (Filename or Prompt)",
|
||||
"Search filenames or prompt metadata...": "Search filenames or prompt metadata...",
|
||||
"Type to load saved workflow...": "Type to load saved workflow...",
|
||||
"No matching workflows": "No matching workflows"
|
||||
}
|
||||
"No matching workflows": "No matching workflows",
|
||||
"Move selected image to Outputs (Ctrl+Click)": "Move selected image to Outputs (Ctrl+Click)",
|
||||
"Moved selected image to Outputs.": "Moved selected image to Outputs.",
|
||||
"Failed to move image to Outputs.": "Failed to move image to Outputs.",
|
||||
"Move to Outputs": "Move to Outputs"
|
||||
}
|
||||
|
||||
@@ -129,5 +129,9 @@
|
||||
"Search Gallery (Filename or Prompt)": "Buscar en galería (nombre de archivo o prompt)",
|
||||
"Search filenames or prompt metadata...": "Buscar nombres de archivo o metadatos de prompt...",
|
||||
"Type to load saved workflow...": "Escribe para cargar un flujo guardado...",
|
||||
"No matching workflows": "No hay flujos coincidentes"
|
||||
}
|
||||
"No matching workflows": "No hay flujos coincidentes",
|
||||
"Move to Outputs": "Mover a resultados",
|
||||
"Move selected image to Outputs (Ctrl+Click)": "Mover la imagen seleccionada a resultados (Ctrl+clic)",
|
||||
"Moved selected image to Outputs.": "Imagen seleccionada movida a resultados.",
|
||||
"Failed to move image to Outputs.": "No se pudo mover la imagen a resultados."
|
||||
}
|
||||
|
||||
@@ -129,5 +129,9 @@
|
||||
"Search Gallery (Filename or Prompt)": "جستجو در گالری (نام فایل یا پرامپت)",
|
||||
"Search filenames or prompt metadata...": "جستجوی نام فایلها یا متادیتای پرامپت...",
|
||||
"Type to load saved workflow...": "برای بارگذاری گردش کار ذخیرهشده تایپ کنید...",
|
||||
"No matching workflows": "گردش کار مطابقی یافت نشد"
|
||||
}
|
||||
"No matching workflows": "گردش کار مطابقی یافت نشد",
|
||||
"Move to Outputs": "انتقال به خروجیها",
|
||||
"Move selected image to Outputs (Ctrl+Click)": "انتقال تصویر انتخابشده به خروجیها (Ctrl+کلیک)",
|
||||
"Moved selected image to Outputs.": "تصویر انتخابشده به خروجیها منتقل شد.",
|
||||
"Failed to move image to Outputs.": "انتقال تصویر به خروجیها ناموفق بود."
|
||||
}
|
||||
|
||||
@@ -129,5 +129,9 @@
|
||||
"Search Gallery (Filename or Prompt)": "Rechercher dans la galerie (nom de fichier ou prompt)",
|
||||
"Search filenames or prompt metadata...": "Rechercher des noms de fichiers ou métadonnées de prompt...",
|
||||
"Type to load saved workflow...": "Tapez pour charger un workflow enregistré...",
|
||||
"No matching workflows": "Aucun workflow correspondant"
|
||||
}
|
||||
"No matching workflows": "Aucun workflow correspondant",
|
||||
"Move to Outputs": "Déplacer vers les sorties",
|
||||
"Move selected image to Outputs (Ctrl+Click)": "Déplacer l’image sélectionnée vers les sorties (Ctrl+clic)",
|
||||
"Moved selected image to Outputs.": "Image sélectionnée déplacée vers les sorties.",
|
||||
"Failed to move image to Outputs.": "Impossible de déplacer l’image vers les sorties."
|
||||
}
|
||||
|
||||
@@ -129,5 +129,9 @@
|
||||
"Search Gallery (Filename or Prompt)": "חיפוש בגלריה (שם קובץ או פרומפט)",
|
||||
"Search filenames or prompt metadata...": "חיפוש שמות קבצים או מטא-דאטה של פרומפט...",
|
||||
"Type to load saved workflow...": "הקלד כדי לטעון תהליך עבודה שמור...",
|
||||
"No matching workflows": "לא נמצאו תהליכי עבודה תואמים"
|
||||
}
|
||||
"No matching workflows": "לא נמצאו תהליכי עבודה תואמים",
|
||||
"Move to Outputs": "העבר לפלט",
|
||||
"Move selected image to Outputs (Ctrl+Click)": "העבר את התמונה שנבחרה לפלט (Ctrl+לחיצה)",
|
||||
"Moved selected image to Outputs.": "התמונה שנבחרה הועברה לפלט.",
|
||||
"Failed to move image to Outputs.": "העברת התמונה לפלט נכשלה."
|
||||
}
|
||||
|
||||
@@ -129,5 +129,9 @@
|
||||
"Search Gallery (Filename or Prompt)": "Cerca nella galleria (nome file o prompt)",
|
||||
"Search filenames or prompt metadata...": "Cerca nomi di file o metadati del prompt...",
|
||||
"Type to load saved workflow...": "Digita per caricare un workflow salvato...",
|
||||
"No matching workflows": "Nessun workflow corrispondente"
|
||||
}
|
||||
"No matching workflows": "Nessun workflow corrispondente",
|
||||
"Move to Outputs": "Sposta negli output",
|
||||
"Move selected image to Outputs (Ctrl+Click)": "Sposta l’immagine selezionata negli output (Ctrl+clic)",
|
||||
"Moved selected image to Outputs.": "Immagine selezionata spostata negli output.",
|
||||
"Failed to move image to Outputs.": "Impossibile spostare l’immagine negli output."
|
||||
}
|
||||
|
||||
@@ -129,5 +129,9 @@
|
||||
"Search Gallery (Filename or Prompt)": "ギャラリーを検索 (ファイル名またはプロンプト)",
|
||||
"Search filenames or prompt metadata...": "ファイル名またはプロンプトを検索...",
|
||||
"Type to load saved workflow...": "保存済みワークフローを読み込むには入力...",
|
||||
"No matching workflows": "一致するワークフローがありません"
|
||||
}
|
||||
"No matching workflows": "一致するワークフローがありません",
|
||||
"Move to Outputs": "出力フォルダーへ移動",
|
||||
"Move selected image to Outputs (Ctrl+Click)": "選択した画像を出力フォルダーへ移動 (Ctrl+クリック)",
|
||||
"Moved selected image to Outputs.": "選択した画像を出力フォルダーへ移動しました。",
|
||||
"Failed to move image to Outputs.": "画像を出力フォルダーへ移動できませんでした。"
|
||||
}
|
||||
|
||||
@@ -129,5 +129,9 @@
|
||||
"Search Gallery (Filename or Prompt)": "갤러리 검색 (파일명 또는 프롬프트)",
|
||||
"Search filenames or prompt metadata...": "파일명 또는 프롬프트 메타데이터 검색...",
|
||||
"Type to load saved workflow...": "저장된 워크플로우를 불러오려면 입력하세요...",
|
||||
"No matching workflows": "일치하는 워크플로우가 없습니다"
|
||||
}
|
||||
"No matching workflows": "일치하는 워크플로우가 없습니다",
|
||||
"Move to Outputs": "출력 폴더로 이동",
|
||||
"Move selected image to Outputs (Ctrl+Click)": "선택한 이미지를 출력 폴더로 이동 (Ctrl+클릭)",
|
||||
"Moved selected image to Outputs.": "선택한 이미지를 출력 폴더로 이동했습니다.",
|
||||
"Failed to move image to Outputs.": "이미지를 출력 폴더로 이동하지 못했습니다."
|
||||
}
|
||||
|
||||
@@ -129,5 +129,9 @@
|
||||
"Search Gallery (Filename or Prompt)": "Pesquisar na galeria (nome do arquivo ou prompt)",
|
||||
"Search filenames or prompt metadata...": "Pesquisar nomes de arquivos ou metadados de prompt...",
|
||||
"Type to load saved workflow...": "Digite para carregar um fluxo salvo...",
|
||||
"No matching workflows": "Nenhum fluxo correspondente"
|
||||
}
|
||||
"No matching workflows": "Nenhum fluxo correspondente",
|
||||
"Move to Outputs": "Mover para Outputs",
|
||||
"Move selected image to Outputs (Ctrl+Click)": "Mover a imagem selecionada para Outputs (Ctrl+clique)",
|
||||
"Moved selected image to Outputs.": "Imagem selecionada movida para Outputs.",
|
||||
"Failed to move image to Outputs.": "Não foi possível mover a imagem para Outputs."
|
||||
}
|
||||
|
||||
@@ -129,6 +129,9 @@
|
||||
"Search Gallery (Filename or Prompt)": "Поиск по галерее (имя файла или промпт)",
|
||||
"Search filenames or prompt metadata...": "Поиск по именам файлов или промптам...",
|
||||
"Type to load saved workflow...": "Найти сохранённый рабочий процесс...",
|
||||
"No matching workflows": "Подходящие рабочие процессы не найдены"
|
||||
"No matching workflows": "Подходящие рабочие процессы не найдены",
|
||||
"Move to Outputs": "Переместить в Outputs",
|
||||
"Move selected image to Outputs (Ctrl+Click)": "Переместить выбранное изображение в Outputs (Ctrl+щелчок)",
|
||||
"Moved selected image to Outputs.": "Выбранное изображение перемещено в Outputs.",
|
||||
"Failed to move image to Outputs.": "Не удалось переместить изображение в Outputs."
|
||||
}
|
||||
|
||||
|
||||
@@ -142,5 +142,9 @@
|
||||
"Search Gallery (Filename or Prompt)": "Galeride Ara (Dosya Adı veya Prompt)",
|
||||
"Search filenames or prompt metadata...": "Dosya adlarını veya prompt meta verilerini ara...",
|
||||
"Type to load saved workflow...": "Kayıtlı iş akışını yüklemek için yazın...",
|
||||
"No matching workflows": "Eşleşen iş akışı yok"
|
||||
}
|
||||
"No matching workflows": "Eşleşen iş akışı yok",
|
||||
"Move to Outputs": "Çıktılara taşı",
|
||||
"Move selected image to Outputs (Ctrl+Click)": "Seçili görseli çıktılara taşı (Ctrl+tık)",
|
||||
"Moved selected image to Outputs.": "Seçili görsel çıktılara taşındı.",
|
||||
"Failed to move image to Outputs.": "Görsel çıktılara taşınamadı."
|
||||
}
|
||||
|
||||
@@ -129,5 +129,9 @@
|
||||
"Search Gallery (Filename or Prompt)": "搜尋圖庫 (檔案名稱或提示詞)",
|
||||
"Search filenames or prompt metadata...": "搜尋檔案名稱或提示詞元資料...",
|
||||
"Type to load saved workflow...": "輸入以載入已儲存的工作流程...",
|
||||
"No matching workflows": "沒有符合的工作流程"
|
||||
}
|
||||
"No matching workflows": "沒有符合的工作流程",
|
||||
"Move to Outputs": "移至輸出資料夾",
|
||||
"Move selected image to Outputs (Ctrl+Click)": "將選取的圖片移至輸出資料夾 (Ctrl+點擊)",
|
||||
"Moved selected image to Outputs.": "已將選取的圖片移至輸出資料夾。",
|
||||
"Failed to move image to Outputs.": "無法將圖片移至輸出資料夾。"
|
||||
}
|
||||
|
||||
@@ -129,5 +129,9 @@
|
||||
"Search Gallery (Filename or Prompt)": "搜索图库 (文件名或提示词)",
|
||||
"Search filenames or prompt metadata...": "搜索文件名或提示词元数据...",
|
||||
"Type to load saved workflow...": "输入以加载已保存的工作流...",
|
||||
"No matching workflows": "没有匹配的工作流"
|
||||
}
|
||||
"No matching workflows": "没有匹配的工作流",
|
||||
"Move to Outputs": "移动到输出目录",
|
||||
"Move selected image to Outputs (Ctrl+Click)": "将选中的图像移动到输出目录 (Ctrl+单击)",
|
||||
"Moved selected image to Outputs.": "已将选中的图像移动到输出目录。",
|
||||
"Failed to move image to Outputs.": "无法将图像移动到输出目录。"
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "comfy-sidebar"
|
||||
description = "A compact and powerful layout overhaul for ComfyUI that makes generation results easier to browse, preview, compare, and manage."
|
||||
version = "1.8.5"
|
||||
version = "1.8.6"
|
||||
license = { file = "LICENSE" }
|
||||
dependencies = [
|
||||
"send2trash>=1.8.0",
|
||||
|
||||
Reference in New Issue
Block a user