(text)
| 3 | import { escapeHTML, showToast } from './domUtils.js?v={{APP_QVER}}'; |
| 4 | |
| 5 | async function copyTextToClipboard(text) { |
| 6 | if (navigator.clipboard && window.isSecureContext) { |
| 7 | await navigator.clipboard.writeText(text); |
| 8 | return true; |
| 9 | } |
| 10 | const ta = document.createElement('textarea'); |
| 11 | ta.value = text; |
| 12 | ta.setAttribute('readonly', ''); |
| 13 | ta.style.position = 'absolute'; |
| 14 | ta.style.left = '-9999px'; |
| 15 | document.body.appendChild(ta); |
| 16 | ta.select(); |
| 17 | let ok = false; |
| 18 | try { |
| 19 | ok = document.execCommand('copy'); |
| 20 | } catch (e) { |
| 21 | ok = false; |
| 22 | } finally { |
| 23 | ta.remove(); |
| 24 | } |
| 25 | return ok; |
| 26 | } |
| 27 | |
| 28 | function buildInternalLink(token) { |
| 29 | return `${window.location.origin}${withBase(`/index.html?fileLink=${encodeURIComponent(token)}`)}`; |
no outgoing calls
no test coverage detected