MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / copyTextToClipboard

Function copyTextToClipboard

packages/studio/src/utils/clipboard.ts:40–57  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

38}
39
40export async function copyTextToClipboard(text: string): Promise<boolean> {
41 const useSelectionFirst = shouldCopyWithSelectionFirst();
42 if (useSelectionFirst && copyWithSelection(text)) {
43 return true;
44 }
45
46 const clipboard = typeof navigator !== "undefined" ? navigator.clipboard : undefined;
47 if (clipboard?.writeText) {
48 try {
49 await clipboard.writeText(text);
50 return true;
51 } catch {
52 // Fall back below when the browser still allows synchronous copy.
53 }
54 }
55
56 return !useSelectionFirst && copyWithSelection(text);
57}

Callers 5

handleCopyToAgentFunction · 0.90
AssetsTab.tsxFile · 0.90
clipboard.test.tsFile · 0.90
EditPopoverFunction · 0.90
useAskAgentModalFunction · 0.90

Calls 2

copyWithSelectionFunction · 0.85

Tested by

no test coverage detected