diff --git a/src/lib/components/Terminal.svelte b/src/lib/components/Terminal.svelte index cf6491b..fb6faab 100644 --- a/src/lib/components/Terminal.svelte +++ b/src/lib/components/Terminal.svelte @@ -155,6 +155,30 @@ terminalElement.removeEventListener("copy", handleCopy); } }); + + // Copy message content to clipboard + async function copyMessage(content: string) { + try { + await navigator.clipboard.writeText(content); + // Optionally capture to clipboard history + await clipboardStore.captureClipboard(content, null, "Message from chat"); + + // Visual feedback could be added here if needed + } catch (error) { + console.error("Failed to copy message:", error); + } + } + + // State for showing "Copied!" feedback + let copiedMessageId: string | null = null; + + async function handleCopyMessage(messageId: string, content: string) { + await copyMessage(content); + copiedMessageId = messageId; + setTimeout(() => { + copiedMessageId = null; + }, 2000); + }