UNPKG

@lobehub/ui

Version:

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

1 lines 720 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;AACrD,KAAI;AACF,QAAM,UAAU,UAAU,UAAU,KAAK;SACnC;EACN,MAAM,WAAW,SAAS,cAAc,WAAW;AACnD,WAAS,QAAQ;AACjB,WAAS,KAAK,OAAO,SAAS;AAC9B,WAAS,OAAO;AAChB,WAAS,QAAQ;AACjB,WAAS,YAAY,OAAO;AAC5B,WAAS,QAAQ"}