MCPcopy Create free account
hub / github.com/clair-design/clair / tinyCopy

Function tinyCopy

docs/plugins/scripts/tiny-copy.js:54–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54const tinyCopy = elem => {
55 if (typeof window === 'undefined') return
56
57 // eslint-disable-next-line
58 if (elem instanceof HTMLTextAreaElement) {
59 elem.focus()
60 elem.select()
61 execCopy()
62 return
63 }
64
65 // eslint-disable-next-line
66 if (elem instanceof HTMLElement || elem === document) {
67 elem = elem === document ? elem.documentElement : elem
68 return copyFromElement(elem)
69 }
70
71 if (typeof elem === 'string') {
72 copyFromText(elem)
73 }
74}
75
76module.exports = tinyCopy

Callers 1

copyFunction · 0.85

Calls 3

execCopyFunction · 0.85
copyFromElementFunction · 0.85
copyFromTextFunction · 0.85

Tested by

no test coverage detected