From 74a6c78da147dc79e8085e108d1683e5d4708db0 Mon Sep 17 00:00:00 2001 From: Arjun <6592213+arkml@users.noreply.github.com> Date: Thu, 14 May 2026 15:06:03 +0530 Subject: [PATCH] send button opens the thread --- .../renderer/src/components/email-view.tsx | 41 +++++++++++++++++-- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/apps/x/apps/renderer/src/components/email-view.tsx b/apps/x/apps/renderer/src/components/email-view.tsx index 959c5c71..d5229df8 100644 --- a/apps/x/apps/renderer/src/components/email-view.tsx +++ b/apps/x/apps/renderer/src/components/email-view.tsx @@ -466,6 +466,42 @@ function ComposeBox({ if (editor && sel) editor.chain().focus().setTextSelection(sel).run() } + const sendInGmail = async () => { + if (!editor) { + window.open(thread.threadUrl, '_blank') + return + } + const html = editor.getHTML() + const text = editor.getText().trim() + + let copied = false + if (text) { + try { + if (typeof ClipboardItem !== 'undefined' && navigator.clipboard?.write) { + await navigator.clipboard.write([ + new ClipboardItem({ + 'text/html': new Blob([html], { type: 'text/html' }), + 'text/plain': new Blob([text], { type: 'text/plain' }), + }), + ]) + copied = true + } else if (navigator.clipboard?.writeText) { + await navigator.clipboard.writeText(text) + copied = true + } + } catch (err) { + console.warn('[Gmail] clipboard write failed:', err) + } + } + + window.open(thread.threadUrl, '_blank') + if (copied) { + toast('Draft copied — open the reply in Gmail and paste.', 'info') + } else if (text) { + toast('Could not copy draft. Open Gmail and paste manually.', 'error') + } + } + const refineWithCopilot = () => { if (!editor) return const currentDraft = editor.getText().trim() @@ -540,9 +576,8 @@ function ComposeBox({