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

Function copyFromElement

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

Source from the content-addressed store, hash-verified

24 * copy from element
25 */
26const copyFromElement = elem => {
27 const range = document.createRange()
28 const selection = window.getSelection()
29
30 range.selectNode(elem)
31
32 if (selection.rangeCount > 0) {
33 selection.removeAllRanges()
34 }
35
36 selection.addRange(range)
37 execCopy()
38 selection.removeAllRanges()
39}
40
41/**
42 * copy from textarea

Callers 1

tinyCopyFunction · 0.85

Calls 1

execCopyFunction · 0.85

Tested by

no test coverage detected