1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Fixed copy to clipboard to work on non-firefox/chrome browsers.

This commit is contained in:
Ylian Saint-Hilaire 2019-06-06 13:34:18 -07:00
parent 7e6d4e6b48
commit 684d266ad1
3 changed files with 9 additions and 7 deletions

View file

@ -285,8 +285,9 @@
else { openTab(null, 'wintab64'); }
}
function copyToClipLinuxInstall() { navigator.clipboard.writeText(linuxInstall); }
function copyToClipLinuxUnInstall() { navigator.clipboard.writeText(linuxUnInstall); }
function copyToClipLinuxInstall() { copyTextToClip(linuxInstall); }
function copyToClipLinuxUnInstall() { copyTextToClip(linuxUnInstall); }
function copyTextToClip(txt) { function selectElementText(e) { if (document.selection) { var range = document.body.createTextRange(); range.moveToElementText(e); range.select(); } else if (window.getSelection) { var range = document.createRange(); range.selectNode(e); window.getSelection().removeAllRanges(); window.getSelection().addRange(range); } } var e = document.createElement('DIV'); e.textContent = txt; document.body.appendChild(e); selectElementText(e); document.execCommand('copy'); e.remove(); }
</script>
</body>