MCPcopy Create free account
hub / github.com/amaancoderx/skillui / copy

Function copy

components/CodeBlock.tsx:33–46  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31function useCopy(text: string) {
32 const [copied, setCopied] = useState(false)
33 const copy = async () => {
34 try {
35 await navigator.clipboard.writeText(text)
36 } catch {
37 const el = document.createElement('textarea')
38 el.value = text
39 document.body.appendChild(el)
40 el.select()
41 document.execCommand('copy')
42 document.body.removeChild(el)
43 }
44 setCopied(true)
45 setTimeout(() => setCopied(false), 2000)
46 }
47 return { copied, copy }
48}
49

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected