MCPcopy Create free account
hub / github.com/error311/FileRise / copyTextToClipboard

Function copyTextToClipboard

public/js/folderShareModal.js:45–66  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

43}
44
45async function copyTextToClipboard(text) {
46 if (navigator.clipboard && window.isSecureContext) {
47 await navigator.clipboard.writeText(text);
48 return true;
49 }
50 const ta = document.createElement("textarea");
51 ta.value = text;
52 ta.setAttribute("readonly", "");
53 ta.style.position = "absolute";
54 ta.style.left = "-9999px";
55 document.body.appendChild(ta);
56 ta.select();
57 let ok = false;
58 try {
59 ok = document.execCommand("copy");
60 } catch (e) {
61 ok = false;
62 } finally {
63 ta.remove();
64 }
65 return ok;
66}
67
68function openFolderShareResultModal(link) {
69 const existing = document.getElementById("folderShareResultModal");

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected