Compare commits

...
1 Commits
Author SHA1 Message Date
ketle-manandClaude Opus 4.6 a5e481a6a5 v0.1.2: Add Canvas Snapshot and Thumbnail preview
- Add canvas snapshot button (camera icon) to ComfyUI top bar
- Capture workflow canvas as PNG with embedded workflow metadata (tEXt chunk)
- Auto-import captured snapshots to Workflow tab with thumbnails
- Add Thumbnail tab to workflow side panel for visual preview
- Add Thumbnail section to workflow detail modal
- Update README with v0.1.2 features, screenshots, and acknowledgements

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 14:19:45 +09:00
11 changed files with 527 additions and 10 deletions
+35 -4
View File
@@ -5,6 +5,7 @@ A comprehensive workflow management and generation UI plugin for [ComfyUI](https
Browse, organize, and execute workflows directly from a dedicated studio interface — without switching between windows or manually editing JSON.
![Workflow Studio](https://img.shields.io/badge/ComfyUI-Custom_Node-blue)
![Version](https://img.shields.io/badge/version-0.1.2-green)
## Screenshots
@@ -16,20 +17,31 @@ Browse, organize, and execute workflows directly from a dedicated studio interfa
|:---:|:---:|
| ![Prompt](docs/screenshot_prompt.png) | ![Settings](docs/screenshot_settings.png) |
| ComfyUI Integration |
|:---:|
| ![ComfyUI Top Bar](docs/screenshot_comfyui_topbar.png) |
---
## Features
### Workflow Tab
- **Thumbnail / Card / Table views** — switch between view modes to browse your workflow library
- **Thumbnail side panel** — preview workflow canvas snapshots in the side panel
- **Tag-based filtering** — filter by base model (SD1.5, SDXL, etc.) and custom groups
- **Search** — full-text search across workflow names and metadata
- **Side panel** — view workflow JSON with syntax highlighting, format badge (UI/API), and copy button
- **Side panel tabs** — Thumbnail preview, JSON viewer with syntax highlighting, and Group management
- **Batch analysis** — auto-detect checkpoint, model type, prompt, and I/O node counts
- **AI summary** — generate workflow descriptions using Ollama
- **Import / Export** — import workflows from files or clipboard, open in ComfyUI directly
- **Default view setting** — persist your preferred view mode (Thumbnail / Card / Table)
### Canvas Snapshot (v0.1.2)
- **One-click capture** — click the camera button in ComfyUI's top bar to snapshot the current workflow canvas
- **Auto-save as thumbnail** — the snapshot is saved directly to the workflow data folder as a PNG thumbnail
- **Embedded workflow metadata** — workflow JSON is embedded in the PNG (tEXt chunk), compatible with ComfyUI's drag-and-drop import
- **Auto-import** — the captured workflow is automatically imported and appears in the Workflow tab
### GenerateUI Tab
- **Auto-generated parameter UI** — prompt, model, sampler, image, and other settings extracted from the workflow
- **One-click generation** — queue prompts to ComfyUI without leaving the studio
@@ -76,18 +88,22 @@ Restart ComfyUI after installation.
### Launch
Click the **WS** button in the ComfyUI top menu bar, or navigate to:
Click the **W** button in the ComfyUI top menu bar, or navigate to:
```
http://127.0.0.1:8188/wfm
```
> **Tip:** Shift+Click the WS button to open in a new window.
> **Tip:** Shift+Click the W button to open in a new window.
### Canvas Snapshot
Click the **camera icon** (next to the W button) in ComfyUI's top bar to capture the current workflow canvas as a thumbnail. The image is automatically saved to the workflow data folder and appears in Workflow Studio's workflow list.
### Quick Start
1. **Workflow Tab** — Your workflows from `ComfyUI/user/default/workflows/` are automatically listed
2. **Click a workflow** — View JSON details and metadata in the side panel
2. **Click a workflow** — View thumbnail, JSON details, and metadata in the side panel
3. **Load in GenerateUI** — Click the button to load a workflow into the generation interface
4. **Adjust parameters** — Modify prompts, models, seeds, and settings via the auto-generated UI
5. **Generate** — Hit the Generate button to queue the prompt
@@ -117,6 +133,19 @@ http://127.0.0.1:8188/wfm
---
## Changelog
### v0.1.2
- Added **Canvas Snapshot** button to ComfyUI top bar — capture workflow canvas as PNG thumbnail with embedded workflow metadata
- Added **Thumbnail tab** to the workflow side panel for quick visual preview
- Added **Thumbnail section** to the workflow detail modal
- Snapshot images are auto-imported as workflows with thumbnails
### v0.1.1
- Initial feature set: Workflow management, GenerateUI, Prompt assistant, Settings
---
## Project Structure
```
@@ -167,5 +196,7 @@ MIT License
## Acknowledgements
- [ComfyUI](https://github.com/comfyanonymous/ComfyUI) by comfyanonymous
- [ComfyUI-Custom-Scripts](https://github.com/pythongosssss/ComfyUI-Custom-Scripts) by pythongosssss — Canvas snapshot and PNG workflow embedding implementation reference
- [ComfyUI-Lora-Manager](https://github.com/willchil/ComfyUI-Lora-Manager) — Plugin architecture and UI pattern reference
- [Ollama](https://ollama.com/) for local LLM inference
- [Eagle](https://eagle.cool/) for image management
Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 56 KiB

+41
View File
@@ -27,6 +27,9 @@ def setup_routes(app: web.Application):
app.router.add_post(
"/api/wfm/workflows/change-thumbnail", handle_change_thumbnail
)
app.router.add_post(
"/api/wfm/workflows/save-canvas-image", handle_save_canvas_image
)
async def handle_list(request: web.Request) -> web.Response:
@@ -157,6 +160,44 @@ async def handle_reanalyze_all(request: web.Request) -> web.Response:
return web.json_response({"error": str(e)}, status=500)
async def handle_save_canvas_image(request: web.Request) -> web.Response:
"""POST /api/wfm/workflows/save-canvas-image - Import canvas PNG as workflow + thumbnail."""
try:
reader = await request.multipart()
filename = None
image_data = None
while True:
part = await reader.next()
if part is None:
break
if part.name == "filename":
filename = (await part.read()).decode("utf-8")
elif part.name == "image":
image_data = await part.read()
if not filename or not _service._validate_filename(filename):
return web.json_response({"error": "invalid filename"}, status=400)
if image_data is None:
return web.json_response({"error": "image required"}, status=400)
# Use import_files to extract workflow from PNG and save both JSON + thumbnail
stem = filename[:-5] if filename.endswith(".json") else filename
png_name = stem + ".png"
results = await asyncio.to_thread(
_service.import_files, [(png_name, image_data)]
)
if results and results[0].get("status") == "success":
return web.json_response({"status": "ok", "filename": results[0].get("name", filename)})
else:
error_msg = results[0].get("message", "Import failed") if results else "Import failed"
return web.json_response({"error": error_msg}, status=400)
except Exception as e:
logger.error("Error saving canvas image: %s", e)
return web.json_response({"error": str(e)}, status=500)
async def handle_change_thumbnail(request: web.Request) -> web.Response:
"""POST /api/wfm/workflows/change-thumbnail - Change workflow thumbnail."""
try:
+85
View File
@@ -1648,3 +1648,88 @@ body {
color: var(--wfm-text-secondary);
line-height: 24px;
}
/* ============================================
Side Panel - Thumbnail Tab
============================================ */
.wfm-side-thumb-container {
display: flex;
flex-direction: column;
flex: 1;
overflow-y: auto;
padding: 10px;
gap: 10px;
}
.wfm-side-thumb-img-wrap {
width: 100%;
aspect-ratio: 1 / 1;
background: var(--wfm-bg);
border: 1px solid var(--wfm-border);
border-radius: var(--wfm-radius);
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
.wfm-side-thumb-img-wrap img {
width: 100%;
height: 100%;
object-fit: contain;
cursor: pointer;
transition: transform 0.2s ease;
}
.wfm-side-thumb-img-wrap img:hover {
transform: scale(1.02);
}
.wfm-side-thumb-placeholder {
font-size: 13px;
color: var(--wfm-text-secondary);
}
.wfm-side-thumb-name {
font-size: 13px;
font-weight: 600;
word-break: break-all;
}
.wfm-side-thumb-meta {
font-size: 12px;
color: var(--wfm-text-secondary);
display: flex;
gap: 8px;
flex-wrap: wrap;
}
/* ============================================
Modal - Thumbnail Section
============================================ */
.wfm-modal-thumb-section {
display: flex;
align-items: center;
justify-content: center;
background: var(--wfm-bg);
border: 1px solid var(--wfm-border);
border-radius: var(--wfm-radius);
margin-bottom: 16px;
max-height: 280px;
overflow: hidden;
}
.wfm-modal-thumb-img {
max-width: 100%;
max-height: 280px;
object-fit: contain;
display: block;
}
.wfm-modal-thumb-placeholder {
padding: 32px;
font-size: 13px;
color: var(--wfm-text-secondary);
}
+46
View File
@@ -458,6 +458,9 @@ async function showSidePanel(wf, cardEl) {
);
if (cardEl) cardEl.classList.add("wfm-card-selected");
// Update thumbnail tab
sidePanelThumbUpdate(wf);
// Update group tab
sidePanelGroupUpdate();
@@ -495,6 +498,34 @@ function closeSidePanel() {
sidePanelGroupUpdate();
}
// ============================================
// Thumbnail Tab in Side Panel
// ============================================
function sidePanelThumbUpdate(wf) {
const imgWrap = document.getElementById("wfm-side-thumb-img-wrap");
const nameEl = document.getElementById("wfm-side-thumb-name");
const metaEl = document.getElementById("wfm-side-thumb-meta");
if (!imgWrap) return;
if (wf && wf.thumbnail) {
imgWrap.innerHTML = `<img src="${wf.thumbnail}" alt="${wf.filename}" />`;
} else {
imgWrap.innerHTML = `<span class="wfm-side-thumb-placeholder">${t("noImage")}</span>`;
}
if (nameEl) {
nameEl.textContent = wf ? wf.filename.replace(/\.json$/, "") : "";
}
if (metaEl && wf) {
const badges = (wf.analysis.modelTypes || []).map((mt) => badgeHtml(mt)).join(" ");
const io = `P:${wf.analysis.inputs?.prompts || 0} I:${wf.analysis.inputs?.images || 0} → ${wf.analysis.outputs?.images || 0}`;
metaEl.innerHTML = `${badges} <span style="margin-left:4px;">${io}</span>`;
} else if (metaEl) {
metaEl.innerHTML = "";
}
}
// ============================================
// Group Tab in Side Panel
// ============================================
@@ -646,7 +677,14 @@ function openDetailModal(wf) {
const overrideText = (meta.modelTypesOverride || []).join(", ");
const isFav = !!meta.favorite;
const thumbSrc = wf.thumbnail || "";
const html = `
<div class="wfm-modal-thumb-section">
${thumbSrc
? `<img src="${thumbSrc}" class="wfm-modal-thumb-img" />`
: `<div class="wfm-modal-thumb-placeholder">${t("noImage")}</div>`
}
</div>
<div class="wfm-modal-two-col">
<div class="wfm-modal-left">
<section>
@@ -893,6 +931,14 @@ function openDetailModal(wf) {
const cached = state.workflows.find((w) => w.filename === wf.filename);
if (cached) cached.thumbnail = newUrl;
renderGrid();
sidePanelThumbUpdate(wf);
// Update modal thumbnail if visible
const modalThumbImg = document.querySelector(".wfm-modal-thumb-img");
if (modalThumbImg) modalThumbImg.src = newUrl;
const modalThumbPlaceholder = document.querySelector(".wfm-modal-thumb-placeholder");
if (modalThumbPlaceholder) {
modalThumbPlaceholder.outerHTML = `<img src="${newUrl}" class="wfm-modal-thumb-img" />`;
}
showToast(t("thumbnailChanged"), "success");
} catch (err) {
showToast(t("thumbnailError") + ": " + err.message, "error");
+15 -2
View File
@@ -69,11 +69,24 @@
<button id="wfm-side-panel-close" class="wfm-side-panel-close">&times;</button>
</div>
<div class="wfm-side-tab-nav">
<button class="wfm-side-tab-btn active" data-side-tab="json">JSON</button>
<button class="wfm-side-tab-btn active" data-side-tab="thumb">Thumbnail</button>
<button class="wfm-side-tab-btn" data-side-tab="json">JSON</button>
<button class="wfm-side-tab-btn" data-side-tab="group">Group</button>
</div>
<!-- Thumbnail Tab -->
<div id="wfm-side-tab-thumb" class="wfm-side-tab-content active">
<div class="wfm-side-thumb-container">
<div id="wfm-side-thumb-img-wrap" class="wfm-side-thumb-img-wrap">
<span class="wfm-side-thumb-placeholder">No thumbnail</span>
</div>
<div class="wfm-side-thumb-info">
<div id="wfm-side-thumb-name" class="wfm-side-thumb-name"></div>
<div id="wfm-side-thumb-meta" class="wfm-side-thumb-meta"></div>
</div>
</div>
</div>
<!-- JSON Tab -->
<div id="wfm-side-tab-json" class="wfm-side-tab-content active">
<div id="wfm-side-tab-json" class="wfm-side-tab-content" style="display:none;">
<div class="wfm-side-json-meta">
<span id="wfm-json-format-badge" class="wfm-format-badge"></span>
<button id="wfm-json-copy-btn" class="wfm-btn wfm-btn-sm" style="margin-left:auto;">Copy</button>
+305 -4
View File
@@ -1,6 +1,7 @@
import { app } from "../../scripts/app.js";
const BUTTON_TOOLTIP = "Launch Workflow Studio (Shift+Click opens in new window)";
const SNAPSHOT_TOOLTIP = "Save workflow canvas image as thumbnail";
const WFM_PATH = "/wfm";
const NEW_WINDOW_FEATURES = "width=1400,height=900,resizable=yes,scrollbars=yes,status=yes";
const MAX_ATTACH_ATTEMPTS = 120;
@@ -19,6 +20,239 @@ const openWorkflowStudio = (event) => {
window.open(url, "_blank");
};
// ============================================
// Canvas Snapshot - Export workflow as PNG thumbnail
// ============================================
const getWorkflowFilename = () => {
const now = new Date();
const pad = (n) => String(n).padStart(2, "0");
const stamp = `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
return `wf_${stamp}.json`;
};
// ---- PNG tEXt chunk embedding helpers ----
const n2b = (n) => new Uint8Array([(n >> 24) & 0xff, (n >> 16) & 0xff, (n >> 8) & 0xff, n & 0xff]);
const joinArrayBuffer = (...bufs) => {
const result = new Uint8Array(bufs.reduce((total, buf) => total + buf.byteLength, 0));
bufs.reduce((offset, buf) => {
result.set(buf, offset);
return offset + buf.byteLength;
}, 0);
return result;
};
let _crcTable = null;
const crc32 = (data) => {
if (!_crcTable) {
_crcTable = [];
for (let n = 0; n < 256; n++) {
let c = n;
for (let k = 0; k < 8; k++) {
c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;
}
_crcTable[n] = c;
}
}
let crc = 0 ^ -1;
for (let i = 0; i < data.byteLength; i++) {
crc = (crc >>> 8) ^ _crcTable[(crc ^ data[i]) & 0xff];
}
return (crc ^ -1) >>> 0;
};
const embedWorkflowInPng = async (blob, workflowJson) => {
const buffer = await blob.arrayBuffer();
const typedArr = new Uint8Array(buffer);
const view = new DataView(buffer);
// Create tEXt chunk: "tEXtworkflow\0{json}"
const data = new TextEncoder().encode(`tEXtworkflow\0${workflowJson}`);
const chunk = joinArrayBuffer(n2b(data.byteLength - 4), data, n2b(crc32(data)));
// Insert after IHDR chunk (8-byte signature + IHDR length field(4) + IHDR type(4) + IHDR data + CRC(4))
const ihdrDataLen = view.getUint32(8);
const sz = ihdrDataLen + 20; // 8(sig) + 4(len) + 4(type) + ihdrDataLen + 4(crc)
const result = joinArrayBuffer(typedArr.subarray(0, sz), chunk, typedArr.subarray(sz));
return new Blob([result], { type: "image/png" });
};
// ---- Canvas capture ----
const captureCanvasSnapshot = () => {
return new Promise((resolve, reject) => {
try {
const graph = app.graph;
const canvas = app.canvas;
if (!graph || !canvas || !graph._nodes?.length) {
reject(new Error("No workflow loaded"));
return;
}
// Serialize workflow data before changing canvas state
const workflowJson = JSON.stringify(graph.serialize());
// Calculate bounds of all nodes
const bounds = graph._nodes.reduce(
(p, n) => {
if (n.pos[0] < p[0]) p[0] = n.pos[0];
if (n.pos[1] < p[1]) p[1] = n.pos[1];
const b = n.getBounding();
const r = n.pos[0] + b[2];
const bot = n.pos[1] + b[3];
if (r > p[2]) p[2] = r;
if (bot > p[3]) p[3] = bot;
return p;
},
[99999, 99999, -99999, -99999]
);
// Add padding
const padding = 80;
bounds[0] -= padding;
bounds[1] -= padding;
bounds[2] += padding;
bounds[3] += padding;
// Save current canvas state
const savedState = {
scale: canvas.ds.scale,
width: canvas.canvas.width,
height: canvas.canvas.height,
offset: [...canvas.ds.offset],
transform: canvas.canvas.getContext("2d").getTransform(),
};
// Set canvas to render full workflow
const dpr = window.devicePixelRatio || 1;
canvas.ds.scale = 1;
canvas.canvas.width = (bounds[2] - bounds[0]) * dpr;
canvas.canvas.height = (bounds[3] - bounds[1]) * dpr;
canvas.ds.offset = [-bounds[0], -bounds[1]];
canvas.canvas.getContext("2d").setTransform(dpr, 0, 0, dpr, 0, 0);
// Render
canvas.draw(true, true);
// Capture to blob
canvas.canvas.toBlob(async (rawBlob) => {
// Restore canvas state
canvas.ds.scale = savedState.scale;
canvas.canvas.width = savedState.width;
canvas.canvas.height = savedState.height;
canvas.ds.offset = savedState.offset;
canvas.canvas.getContext("2d").setTransform(savedState.transform);
canvas.draw(true, true);
if (!rawBlob) {
reject(new Error("Failed to generate canvas image"));
return;
}
try {
// Embed workflow JSON into PNG tEXt chunk
const blob = await embedWorkflowInPng(rawBlob, workflowJson);
resolve(blob);
} catch (embedErr) {
console.warn("Workflow Studio: failed to embed workflow metadata, saving without it:", embedErr);
resolve(rawBlob);
}
}, "image/png");
} catch (err) {
reject(err);
}
});
};
const saveCanvasToWorkflowStudio = async () => {
const filename = getWorkflowFilename();
try {
showNotification("Capturing workflow image...", "info");
const blob = await captureCanvasSnapshot();
const fd = new FormData();
fd.append("filename", filename);
fd.append("image", blob, "canvas.png");
const res = await fetch("/api/wfm/workflows/save-canvas-image", {
method: "POST",
body: fd,
});
const data = await res.json();
if (data.error) {
throw new Error(data.error);
}
showNotification(`Workflow saved: ${filename.replace(/\.json$/, "")}`, "success");
} catch (err) {
showNotification("Error: " + err.message, "error");
}
};
const showNotification = (message, type = "info") => {
// Try using ComfyUI's built-in toast if available
try {
if (app.ui?.dialog) {
// Fallback: use a simple temporary notification
}
} catch (e) { /* ignore */ }
// Simple toast notification
const existing = document.getElementById("wfm-snapshot-toast");
if (existing) existing.remove();
const toast = document.createElement("div");
toast.id = "wfm-snapshot-toast";
const colors = {
success: { bg: "rgba(46,213,115,0.95)", color: "#fff" },
error: { bg: "rgba(255,71,87,0.95)", color: "#fff" },
info: { bg: "rgba(74,158,255,0.95)", color: "#fff" },
};
const c = colors[type] || colors.info;
Object.assign(toast.style, {
position: "fixed",
bottom: "24px",
left: "50%",
transform: "translateX(-50%)",
padding: "10px 24px",
background: c.bg,
color: c.color,
borderRadius: "8px",
fontSize: "14px",
fontWeight: "500",
zIndex: "99999",
boxShadow: "0 4px 16px rgba(0,0,0,0.3)",
transition: "opacity 0.3s ease",
whiteSpace: "nowrap",
});
toast.textContent = message;
document.body.appendChild(toast);
if (type !== "info") {
setTimeout(() => {
toast.style.opacity = "0";
setTimeout(() => toast.remove(), 300);
}, 3000);
} else {
// Info messages will be replaced by success/error
setTimeout(() => {
if (toast.parentNode) {
toast.style.opacity = "0";
setTimeout(() => toast.remove(), 300);
}
}, 10000);
}
};
// ============================================
// Version Detection & UI
// ============================================
const getComfyUIFrontendVersion = async () => {
try {
if (window["__COMFYUI_FRONTEND_VERSION__"]) {
@@ -87,6 +321,20 @@ const getWfmIcon = () => {
`;
};
const getSnapshotIcon = () => {
return `
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
<rect x="3" y="5" width="18" height="14" rx="2"/>
<circle cx="12" cy="12" r="3"/>
<path d="M8 5 L9 3 L15 3 L16 5"/>
</svg>
`;
};
// ============================================
// Button Creation
// ============================================
const createTopMenuButton = async () => {
const { ComfyButton } = await import("../../scripts/ui/components/button.js");
@@ -111,6 +359,30 @@ const createTopMenuButton = async () => {
return button;
};
const createSnapshotButton = async () => {
const { ComfyButton } = await import("../../scripts/ui/components/button.js");
const button = new ComfyButton({
icon: "snapshot",
tooltip: SNAPSHOT_TOOLTIP,
app,
enabled: true,
classList: "comfyui-button comfyui-menu-mobile-collapse",
});
button.element.setAttribute("aria-label", SNAPSHOT_TOOLTIP);
button.element.title = SNAPSHOT_TOOLTIP;
if (button.iconElement) {
button.iconElement.innerHTML = getSnapshotIcon();
button.iconElement.style.width = "1.2rem";
button.iconElement.style.height = "1.2rem";
}
button.element.addEventListener("click", saveCanvasToWorkflowStudio);
return button;
};
const attachTopMenuButton = async (attempt = 0) => {
if (document.querySelector(`.${BUTTON_GROUP_CLASS}`)) {
return;
@@ -128,9 +400,10 @@ const attachTopMenuButton = async (attempt = 0) => {
}
const wfmButton = await createTopMenuButton();
const snapshotButton = await createSnapshotButton();
const { ComfyButtonGroup } = await import("../../scripts/ui/components/buttonGroup.js");
const buttonGroup = new ComfyButtonGroup(wfmButton);
const buttonGroup = new ComfyButtonGroup(wfmButton, snapshotButton);
buttonGroup.element.classList.add(BUTTON_GROUP_CLASS);
settingsGroup.element.before(buttonGroup.element);
@@ -161,14 +434,22 @@ const createExtensionObject = (useActionBar) => {
button[aria-label="${BUTTON_TOOLTIP}"].wfm-top-menu-button:hover {
background-color: var(--primary-hover-bg) !important;
}
button[aria-label="${SNAPSHOT_TOOLTIP}"].wfm-snapshot-button {
transition: all 0.2s ease;
border: 1px solid transparent;
}
button[aria-label="${SNAPSHOT_TOOLTIP}"].wfm-snapshot-button:hover {
background-color: var(--primary-hover-bg) !important;
}
`;
document.head.appendChild(style);
};
injectStyles();
const replaceButtonIcon = () => {
const buttons = document.querySelectorAll(`button[aria-label="${BUTTON_TOOLTIP}"]`);
buttons.forEach((button) => {
// WFM launch button
const wfmButtons = document.querySelectorAll(`button[aria-label="${BUTTON_TOOLTIP}"]`);
wfmButtons.forEach((button) => {
button.classList.add("wfm-top-menu-button");
button.innerHTML = getWfmIcon();
button.style.borderRadius = "4px";
@@ -180,7 +461,22 @@ const createExtensionObject = (useActionBar) => {
svg.style.height = "20px";
}
});
if (buttons.length === 0) {
// Snapshot button
const snapButtons = document.querySelectorAll(`button[aria-label="${SNAPSHOT_TOOLTIP}"]`);
snapButtons.forEach((button) => {
button.classList.add("wfm-snapshot-button");
button.innerHTML = getSnapshotIcon();
button.style.borderRadius = "4px";
button.style.padding = "6px";
const svg = button.querySelector("svg");
if (svg) {
svg.style.width = "20px";
svg.style.height = "20px";
}
});
if (wfmButtons.length === 0) {
requestAnimationFrame(replaceButtonIcon);
}
};
@@ -195,6 +491,11 @@ const createExtensionObject = (useActionBar) => {
tooltip: BUTTON_TOOLTIP,
onClick: openWorkflowStudio,
},
{
icon: "icon-[mdi--camera] size-4",
tooltip: SNAPSHOT_TOOLTIP,
onClick: saveCanvasToWorkflowStudio,
},
];
}