@@ -1519,8 +1519,8 @@ function EmailDetail({ auth }: { auth: AuthState }) {
15191519 < button
15201520 onClick = { ( ) => {
15211521 const md = `# ${ email . subject || 'Email' } \n\n**From:** ${ email . from_addr } \n**To:** ${ email . to_addr } \n**Date:** ${ new Date ( email . created_at * 1000 ) . toISOString ( ) } \n\n---\n\n${ bodyText } ` ;
1522+ // Try download, fallback to showing raw text
15221523 try {
1523- // Try standard download first
15241524 const blob = new Blob ( [ md ] , { type : 'text/markdown' } ) ;
15251525 const url = URL . createObjectURL ( blob ) ;
15261526 const a = document . createElement ( 'a' ) ;
@@ -1531,9 +1531,7 @@ function EmailDetail({ auth }: { auth: AuthState }) {
15311531 document . body . removeChild ( a ) ;
15321532 setTimeout ( ( ) => URL . revokeObjectURL ( url ) , 1000 ) ;
15331533 } catch {
1534- // Fallback for in-app browsers (MetaMask, etc.)
1535- const dataUri = 'data:text/markdown;charset=utf-8,' + encodeURIComponent ( md ) ;
1536- window . open ( dataUri , '_blank' ) ;
1534+ prompt ( 'Copy the markdown below:' , md ) ;
15371535 }
15381536 } }
15391537 className = "text-gray-500 hover:text-gray-300 text-xs flex items-center gap-1 transition"
@@ -1542,20 +1540,10 @@ function EmailDetail({ auth }: { auth: AuthState }) {
15421540 </ button >
15431541 < button
15441542 onClick = { ( ) => {
1545- try {
1546- navigator . clipboard . writeText ( bodyText ) ;
1547- } catch {
1548- // Fallback for in-app browsers
1549- const ta = document . createElement ( 'textarea' ) ;
1550- ta . value = bodyText ;
1551- ta . style . position = 'fixed' ;
1552- ta . style . opacity = '0' ;
1553- document . body . appendChild ( ta ) ;
1554- ta . select ( ) ;
1555- document . execCommand ( 'copy' ) ;
1556- document . body . removeChild ( ta ) ;
1557- }
1558- alert ( 'Copied!' ) ;
1543+ navigator . clipboard . writeText ( bodyText ) . then (
1544+ ( ) => alert ( 'Copied!' ) ,
1545+ ( ) => prompt ( 'Copy the text below:' , bodyText ) ,
1546+ ) ;
15591547 } }
15601548 className = "text-gray-500 hover:text-gray-300 text-xs flex items-center gap-1 transition"
15611549 >
0 commit comments