From 8253d2d8d5af90786ff92c295160c5d3d26ad7c1 Mon Sep 17 00:00:00 2001 From: Prakshitha Malla Date: Fri, 29 May 2026 01:38:50 +0530 Subject: [PATCH] feat: add terminal output copy to clipboard action component #112 --- ui/app.js | 27 +++++++++++++++++++++++++++ ui/index.html | 8 ++++++++ 2 files changed, 35 insertions(+) diff --git a/ui/app.js b/ui/app.js index 5dd09d3..f2923fb 100644 --- a/ui/app.js +++ b/ui/app.js @@ -1774,6 +1774,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 5ade3af..a7ad770 100644 --- a/ui/index.html +++ b/ui/index.html @@ -182,6 +182,14 @@

Scripts

+ + +