panel 2 courier api restore

This commit is contained in:
alma 2025-04-25 22:11:33 +02:00
parent 2cb180b7b0
commit f56304775a

View File

@ -192,12 +192,14 @@ export default function ComposeEmail({
// Get the proper content with minimal sanitization to preserve structure // Get the proper content with minimal sanitization to preserve structure
let emailContent = ''; let emailContent = '';
if (decoded.html) { if (decoded.html) {
// Preserve the HTML structure with minimal cleaning // Allow ALL HTML elements and attributes to fully preserve formatting
emailContent = DOMPurify.sanitize(decoded.html, { emailContent = DOMPurify.sanitize(decoded.html, {
ADD_TAGS: ['style', 'meta'], ADD_TAGS: ['style', 'meta', 'link', 'script'],
ADD_ATTR: ['class', 'id', 'style', 'align', 'border', 'cellpadding', 'cellspacing', 'width', 'height'], ADD_ATTR: ['*', 'style', 'class', 'id', 'src', 'href', 'target', 'rel', 'align', 'valign', 'border', 'cellpadding', 'cellspacing', 'bgcolor', 'width', 'height'],
KEEP_CONTENT: true, ALLOW_UNKNOWN_PROTOCOLS: true,
WHOLE_DOCUMENT: false WHOLE_DOCUMENT: true,
RETURN_DOM: false,
KEEP_CONTENT: true
}); });
} else if (decoded.text) { } else if (decoded.text) {
emailContent = `<pre style="white-space: pre-wrap; font-family: inherit;">${decoded.text}</pre>`; emailContent = `<pre style="white-space: pre-wrap; font-family: inherit;">${decoded.text}</pre>`;
@ -210,7 +212,7 @@ export default function ComposeEmail({
<div class="compose-area" contenteditable="true" style="min-height: 100px; padding: 10px;"> <div class="compose-area" contenteditable="true" style="min-height: 100px; padding: 10px;">
<div class="cursor-position" style="min-height: 20px; cursor: text;"><br/></div> <div class="cursor-position" style="min-height: 20px; cursor: text;"><br/></div>
${emailHeader} ${emailHeader}
<div class="email-content" style="margin-top: 10px; border: 1px solid #e5e7eb; padding: 15px; border-radius: 4px; max-height: 400px; overflow-y: auto;"> <div class="email-content" style="margin-top: 10px; border: 1px solid #e5e7eb; padding: 15px; border-radius: 4px; max-height: 500px; overflow-y: auto;">
${emailContent} ${emailContent}
</div> </div>
</div> </div>