diff --git a/frontend/src/lib/clipboard.ts b/frontend/src/lib/clipboard.ts index a35baa50..b7f16bdb 100644 --- a/frontend/src/lib/clipboard.ts +++ b/frontend/src/lib/clipboard.ts @@ -11,12 +11,15 @@ export async function copyToClipboard(content: string) { textArea.style.position = "absolute"; textArea.style.opacity = "0"; document.body.appendChild(textArea); - selectElement(textArea); + textArea.focus(); + textArea.select(); + if (document.execCommand("copy")) { resolve(content); } else { reject(); } + textArea.remove(); } }); @@ -31,13 +34,3 @@ export async function copyToClipboard(content: string) { }); } } - -function selectElement(element: Element) { - const selection = window.getSelection(); - if (selection) { - selection.removeAllRanges(); - const range = document.createRange(); - range.selectNode(element); - selection.addRange(range); - } -} diff --git a/frontend/src/screens/apps/AppCreated.tsx b/frontend/src/screens/apps/AppCreated.tsx index 44bd88eb..e03e494d 100644 --- a/frontend/src/screens/apps/AppCreated.tsx +++ b/frontend/src/screens/apps/AppCreated.tsx @@ -27,7 +27,6 @@ export default function AppCreated() { const queryParams = new URLSearchParams(search); const appId = queryParams.get("app") ?? ""; const appstoreApp = suggestedApps.find((app) => app.id === appId); - console.info(appstoreApp, appId); const [timeout, setTimeout] = useState(false); const [isQRCodeVisible, setIsQRCodeVisible] = useState(false);