|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
import { POPUP_FEATURES } from '@/config'
|
|
|
|
|
import React, { useState, useEffect, useRef } from 'react'
|
|
|
|
|
|
|
|
|
|
const EmailContent = ({ id, content: MailContent, className='', ...props }) => {
|
|
|
|
@ -31,11 +32,12 @@ const EmailContent = ({ id, content: MailContent, className='', ...props }) => {
|
|
|
|
|
width: 900px;
|
|
|
|
|
max-width: 100%;
|
|
|
|
|
}
|
|
|
|
|
img {
|
|
|
|
|
max-width: 90%;
|
|
|
|
|
height: auto;
|
|
|
|
|
object-fit: contain;
|
|
|
|
|
}
|
|
|
|
|
img {
|
|
|
|
|
max-width: 90%;
|
|
|
|
|
height: auto;
|
|
|
|
|
object-fit: contain;
|
|
|
|
|
}
|
|
|
|
|
img:not(a img){ cursor: pointer;}
|
|
|
|
|
</style>
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
@ -58,6 +60,15 @@ const EmailContent = ({ id, content: MailContent, className='', ...props }) => {
|
|
|
|
|
links.forEach((link) => {
|
|
|
|
|
link.setAttribute('target', '_blank')
|
|
|
|
|
})
|
|
|
|
|
const imgs = doc.querySelectorAll('img:not(a img)')
|
|
|
|
|
imgs.forEach((img) => {
|
|
|
|
|
// open img in new tab
|
|
|
|
|
img.addEventListener('click', (e) => {
|
|
|
|
|
// e.preventDefault()
|
|
|
|
|
img.style.cursor = 'pointer'
|
|
|
|
|
window.open(img.src, img.src, POPUP_FEATURES)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
} catch (e) {
|
|
|
|
|
// console.error('Could not access iframe content due to Same-Origin Policy or other error:', e)
|
|
|
|
|
}
|
|
|
|
|