@copilotkit/shared
Version:
<img src="https://github.com/user-attachments/assets/0a6b64d9-e193-4940-a3f6-60334ac34084" alt="banner" style="border-radius: 12px; border: 2px solid #d6d4fa;" />
1 lines • 1.04 kB
Source Map (JSON)
{"version":3,"file":"clipboard.mjs","names":[],"sources":["../../src/utils/clipboard.ts"],"sourcesContent":["/**\n * Safely copies text to the clipboard.\n *\n * Checks that the Clipboard API is available before attempting the write,\n * and catches any errors (e.g. permission denied, insecure context).\n *\n * @param text - The text to copy to the clipboard.\n * @returns `true` if the text was successfully copied, `false` otherwise.\n */\nexport async function copyToClipboard(text: string): Promise<boolean> {\n if (!navigator.clipboard?.writeText) {\n console.error(\"Clipboard API is not available\");\n return false;\n }\n\n try {\n await navigator.clipboard.writeText(text);\n return true;\n } catch (err) {\n console.error(\"Failed to copy to clipboard:\", err);\n return false;\n }\n}\n"],"mappings":";;;;;;;;;;AASA,eAAsB,gBAAgB,MAAgC;AACpE,KAAI,CAAC,UAAU,WAAW,WAAW;AACnC,UAAQ,MAAM,iCAAiC;AAC/C,SAAO;;AAGT,KAAI;AACF,QAAM,UAAU,UAAU,UAAU,KAAK;AACzC,SAAO;UACA,KAAK;AACZ,UAAQ,MAAM,gCAAgC,IAAI;AAClD,SAAO"}