fixes to iframe height

This commit is contained in:
Ahmet Kilinc
2025-04-26 21:21:53 +01:00
parent aa57e51fe3
commit 40e8f30bb4
3 changed files with 6 additions and 3 deletions

View File

@@ -690,7 +690,7 @@ const MailDisplay = ({ emailData, isMuted, index, totalEmails, demo }: Props) =>
</div>
)}
{emailData?.attachments && emailData?.attachments.length > 0 ? (
<div className="mb-4 flex items-center gap-2 px-4 pt-4">
<div className="mb-4 flex items-center gap-2 pt-4">
{emailData?.attachments.map((attachment, index) => (
<div key={index}>
<button
@@ -732,7 +732,7 @@ const MailDisplay = ({ emailData, isMuted, index, totalEmails, demo }: Props) =>
))}
</div>
) : null}
<div className="mb-4 mt-3 flex gap-2 px-4">
<div className="mb-4 mt-3 flex gap-2">
<button
onClick={() => {
setMode('reply');

View File

@@ -18,7 +18,7 @@ export function MailIframe({ html, senderEmail }: { html: string; senderEmail: s
isTrustedSender || settings?.externalImages || false,
);
const iframeRef = useRef<HTMLIFrameElement>(null);
const [height, setHeight] = useState(300);
const [height, setHeight] = useState(0);
const { resolvedTheme } = useTheme();
const onTrustSender = useCallback(

View File

@@ -39,6 +39,9 @@ export const template = (html: string, imagesEnabled: boolean = false) => {
template.head.appendChild(script);
template.body.innerHTML = doc.body.innerHTML;
template.body.style.height = 'min-content';
template.body.style.margin = '0';
template.getElementsByTagName('html')[0]?.setAttribute('style', 'height: min-content;');
template.body.style.backgroundColor = getComputedStyle(document.body).getPropertyValue(
'background-color',
);