diff --git a/frontend/src/index.html b/frontend/src/index.html index 92ff658..6c7d072 100644 --- a/frontend/src/index.html +++ b/frontend/src/index.html @@ -9,7 +9,7 @@ @@ -44,9 +67,14 @@

Document to Markdown Converter

Result
-
+
+
- +
@@ -78,6 +106,7 @@

Document to Markdown Converter

const rawMarkdown = document.getElementById('rawMarkdown'); const toggleViewBtn = document.getElementById('toggleViewBtn'); const downloadBtn = document.getElementById('downloadBtn'); + const copyButton = document.getElementById('copyButton'); // Toggle between rendered and raw markdown toggleViewBtn.addEventListener('click', () => { @@ -141,6 +170,24 @@

Document to Markdown Converter

// Create the initial drop zone HTML FileDropZone.createDropZone('dropZone'); + // Handle copy button + copyButton.addEventListener('click', async () => { + const textToCopy = rawMarkdown.textContent; + try { + await navigator.clipboard.writeText(textToCopy); + copyButton.classList.add('btn-success'); + setTimeout(() => { + copyButton.classList.remove('btn-success'); + }, 1000); + } catch (err) { + console.error('Failed to copy text:', err); + copyButton.classList.add('btn-error'); + setTimeout(() => { + copyButton.classList.remove('btn-error'); + }, 1000); + } + }); + // Handle download downloadBtn.addEventListener('click', () => { const markdown = rawMarkdown.textContent;