diff --git a/ui/app.js b/ui/app.js index c4fb694..aace95e 100644 --- a/ui/app.js +++ b/ui/app.js @@ -3116,6 +3116,33 @@ function closeModal() { // ─── Event Bindings ──────────────────────────────────────── function bindEvents() { + // ─── TERMINAL OUTPUT COPY TO CLIPBOARD ENGINE (#112) ─── + const btnCopyTerminal = document.getElementById('btn-copy-terminal'); + if (btnCopyTerminal) { + btnCopyTerminal.addEventListener('click', async () => { + const terminalBodyText = document.getElementById('terminal-body'); + if (!terminalBodyText) return; + + // Extract pure plaintext console strings, ignoring interface widgets + const logContent = terminalBodyText.innerText; + + try { + // Safely stream string payload directly into host system clipboard channels + await navigator.clipboard.writeText(logContent); + + // Trigger native application notification alert overlay + if (typeof showNotification === 'function') { + showNotification('Terminal logs copied to clipboard!', 'success'); + } else if (typeof notify === 'function') { + notify('Terminal logs copied to clipboard!', 'success'); + } else { + alert('Terminal logs copied to clipboard!'); + } + } catch (err) { + console.error('Failed to copy terminal logs: ', err); + } + }); + } // Terminal Search const cliSearchInput = document.getElementById('cli-search-input'); if (cliSearchInput) { diff --git a/ui/index.html b/ui/index.html index cb41145..9d24c97 100644 --- a/ui/index.html +++ b/ui/index.html @@ -220,6 +220,15 @@

Scripts

+ + + +