UNPKG

@lobehub/ui

Version:

Lobe UI is an open-source UI component library for building AIGC web apps

1 lines 735 B
{"version":3,"file":"copyToClipboard.mjs","names":[],"sources":["../../src/utils/copyToClipboard.ts"],"sourcesContent":["export const copyToClipboard = async (text: string) => {\n try {\n await navigator.clipboard.writeText(text);\n } catch {\n const textArea = document.createElement('textarea');\n textArea.value = text;\n document.body.append(textArea);\n textArea.focus();\n textArea.select();\n document.execCommand('copy');\n textArea.remove();\n }\n};\n"],"mappings":";AAAA,MAAa,kBAAkB,OAAO,SAAiB;CACrD,IAAI;EACF,MAAM,UAAU,UAAU,UAAU,IAAI;CAC1C,QAAQ;EACN,MAAM,WAAW,SAAS,cAAc,UAAU;EAClD,SAAS,QAAQ;EACjB,SAAS,KAAK,OAAO,QAAQ;EAC7B,SAAS,MAAM;EACf,SAAS,OAAO;EAChB,SAAS,YAAY,MAAM;EAC3B,SAAS,OAAO;CAClB;AACF"}