diff --git a/frontend/templates/file_detail.html b/frontend/templates/file_detail.html index fefd1af4..a39077a3 100644 --- a/frontend/templates/file_detail.html +++ b/frontend/templates/file_detail.html @@ -802,6 +802,50 @@ } } + function showCopyFeedback(type, success) { + const btn = document.getElementById(type + '-copy-btn'); + if (!btn) return; + const original = btn.innerHTML; + if (success) { + btn.innerHTML = ' Copied!'; + btn.style.backgroundColor = '#48bb78'; + } else { + btn.innerHTML = ' Failed'; + btn.style.backgroundColor = '#f56565'; + } + setTimeout(() => { + btn.innerHTML = original; + btn.style.backgroundColor = '#4299e1'; + }, 2000); + } + + function copyTextToClipboard(type) { + const contentId = type + '-text-content'; + const content = document.getElementById(contentId); + const text = content ? content.textContent : ''; + + if (!text) return; + + navigator.clipboard.writeText(text).then(() => { + showCopyFeedback(type, true); + }).catch(() => { + // Fallback for older browsers + try { + const textarea = document.createElement('textarea'); + textarea.value = text; + textarea.style.position = 'fixed'; + textarea.style.opacity = '0'; + document.body.appendChild(textarea); + textarea.select(); + const ok = document.execCommand('copy'); + document.body.removeChild(textarea); + showCopyFeedback(type, ok); + } catch (e) { + showCopyFeedback(type, false); + } + }); + } + // Close modal when clicking outside the content window.onclick = function(event) { const modals = document.querySelectorAll('.text-modal'); @@ -1210,12 +1254,21 @@

Extracted Text (Original)

- +
+ + +
@@ -1230,12 +1283,21 @@

Extracted Text (Processed)

- +
+ + +