MCPcopy
hub / github.com/agent0ai/agent-zero / copyBrowserClipboardToHost

Function copyBrowserClipboardToHost

plugins/_browser/webui/browser-store.js:2503–2519  ·  view source on GitHub ↗
(action = "copy")

Source from the content-addressed store, hash-verified

2501 },
2502
2503 async copyBrowserClipboardToHost(action = "copy") {
2504 try {
2505 const clipboard = await this.sendClipboard(action);
2506 const text = String(clipboard?.text || clipboard?.clipboard_text || "");
2507 if (!text) return;
2508 await copyToClipboard(text);
2509 this._clipboardFallbackText = text;
2510 const message = action === "cut" ? "Cut from Browser" : "Copied from Browser";
2511 globalThis.justToast?.(message, "success", 1200, "browser-clipboard");
2512 } catch (error) {
2513 this.error = action === "cut"
2514 ? "Browser cut failed."
2515 : "Browser copy failed.";
2516 globalThis.justToast?.(this.error, "warning", 1800, "browser-clipboard");
2517 console.warn("Browser clipboard copy failed", error);
2518 }
2519 },
2520
2521 async readHostClipboardText() {
2522 const clipboard = globalThis.navigator?.clipboard;

Callers

nothing calls this directly

Calls 1

copyToClipboardFunction · 0.90

Tested by

no test coverage detected