From 40f3edce688d37c0807bb9a1ae0c4ddb20891074 Mon Sep 17 00:00:00 2001 From: hooli Date: Sat, 20 Jun 2026 01:22:22 +0100 Subject: [PATCH] Fix: Markdow Copy now works over non-secure HTTP --- frontend/src/App.tsx | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 069ecb6..1ba82eb 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -442,8 +442,27 @@ export default function App() { const handleExportMd = useCallback(async () => { const md = generateMarkdownTable(nodes) if (!md) { toast.error('No nodes to export'); return } - await navigator.clipboard.writeText(md) - toast.success('Markdown table copied to clipboard') + if (navigator.clipboard && window.isSecureContext) { + await navigator.clipboard.writeText(md) + toast.success('Markdown table copied to clipboard') + } else { + // Only allowed access to navigator.clipboard over HTTPS not HTTP + // Use the temporary 'hidden text area for alternative copy method + const textArea = document.createElement("textarea"); + textArea.value = md; + textArea.style.position = "absolute"; + textArea.style.left = "-999999px"; + document.body.prepend(textArea); + textArea.select(); + try { + document.execCommand('copy'); + toast.success("Markdown table copied to clipboard") + } catch (err) { + toast.error(`Markdown copy failed: ${err instanceof Error ? err.message : String(err)}`) + } finally { + textArea.remove(); + } + } }, [nodes]) const handleExportYaml = useCallback(() => {