MCPcopy
hub / github.com/widgetti/ipyvolume / select_text

Function select_text

js/src/utils.ts:46–59  ·  view source on GitHub ↗
(element)

Source from the content-addressed store, hash-verified

44
45export
46function select_text(element) {
47 const doc = document;
48 if ((doc.body as any).createTextRange) {
49 const range = (document.body as any).createTextRange();
50 range.moveToElementText(element);
51 range.select();
52 } else if (window.getSelection) {
53 const selection = window.getSelection();
54 const range = document.createRange();
55 range.selectNodeContents(element);
56 selection.removeAllRanges();
57 selection.addRange(range);
58 }
59}
60
61export
62function copy_image_to_clipboard(data) {

Callers 1

copy_image_to_clipboardFunction · 0.70

Calls 2

getSelectionMethod · 0.80
selectMethod · 0.45

Tested by

no test coverage detected