| | |
| | | } |
| | | }); |
| | | |
| | | const copyToClipboard = str => { |
| | | let copy, selection, selected; |
| | | copy = createEl('textarea'); |
| | | copy.value = str; |
| | | copy.setAttribute('readonly', ''); |
| | | copy.style.position = 'absolute'; |
| | | copy.style.left = '-9999px'; |
| | | selection = document.getSelection(); |
| | | doc.appendChild(copy); |
| | | // check if there is any selected content |
| | | selected = selection.rangeCount > 0 ? selection.getRangeAt(0) : false; |
| | | copy.select(); |
| | | document.execCommand('copy'); |
| | | doc.removeChild(copy); |
| | | if (selected) { // if a selection existed before copying |
| | | selection.removeAllRanges(); // unselect existing selection |
| | | selection.addRange(selected); // restore the original selection |
| | | } |
| | | } |
| | | |
| | | |
| | | function copyFeedback(parent) { |
| | | const copyText = document.createElement('div'); |
| | | const yanked = 'link_yanked'; |
| | |
| | | |
| | | } |
| | | |
| | | window.addEventListener('load', loadActions()); |
| | | window.addEventListener('load', loadActions()); |