MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / copyToClipboard

Function copyToClipboard

webview-ui/src/utils/clipboard.ts:18–29  ·  view source on GitHub ↗
(text: string, options?: CopyOptions)

Source from the content-addressed store, hash-verified

16 * Copy text to clipboard with error handling
17 */
18export const copyToClipboard = async (text: string, options?: CopyOptions): Promise<boolean> => {
19 try {
20 await navigator.clipboard.writeText(text)
21 options?.onSuccess?.()
22 return true
23 } catch (error) {
24 const err = error instanceof Error ? error : new Error("Failed to copy to clipboard")
25 options?.onError?.(err)
26 console.error("Failed to copy to clipboard:", err)
27 return false
28 }
29}
30
31/**
32 * React hook for managing clipboard copy state with feedback

Callers 1

useCopyToClipboardFunction · 0.85

Calls 1

errorMethod · 0.65

Tested by

no test coverage detected