E-Mails als HTML anzeigen; Antworten zitieren Vornachricht (auch KI)
- HTML-Mails werden in einem sandboxed iframe (ohne allow-scripts) gerendert statt als Quelltext angezeigt; Höhe an Inhalt angepasst, Skripte/Tracking laufen nicht, Layout bleibt isoliert. Reine Text-Mails weiterhin als pre-wrap. Gilt für Postfach und Bewerbung. - Antwortformular ist wie im Mailclient mit der zitierten Vornachricht vorbelegt (Attribution + "> "-Zeilen), Cursor darüber. - KI-Antwort hängt das Zitat unter den generierten Text und erhält den bereinigten Klartext (statt HTML) als Eingabe. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+28
-4
@@ -60,10 +60,16 @@
|
||||
<span class="text-xs text-gray-500 dark:text-gray-400 shrink-0"><%= e.email_date ? new Date(e.email_date).toLocaleString('de-DE') : '' %></span>
|
||||
</div>
|
||||
<p class="text-sm font-medium text-gray-800 dark:text-gray-100 mb-1"><%= e.subject || '(kein Betreff)' %></p>
|
||||
<p class="email-body whitespace-pre-wrap break-words text-sm leading-relaxed text-gray-700 dark:text-gray-300 max-h-40 overflow-hidden"><%= e.body_text || '' %></p>
|
||||
<% if (e.body_text && e.body_text.length > 600) { %>
|
||||
<button type="button" class="email-toggle text-xs text-blue-600 hover:text-blue-800 dark:text-blue-400 hover:underline mt-1"
|
||||
data-expanded="false">Vollständig anzeigen</button>
|
||||
<% if (e.display_srcdoc) { %>
|
||||
<iframe class="email-html-frame w-full border border-gray-200 dark:border-gray-600 rounded bg-white" style="height:6rem"
|
||||
sandbox="allow-same-origin allow-popups allow-popups-to-escape-sandbox" referrerpolicy="no-referrer"
|
||||
srcdoc="<%= e.display_srcdoc %>"></iframe>
|
||||
<% } else { %>
|
||||
<p class="email-body whitespace-pre-wrap break-words text-sm leading-relaxed text-gray-700 dark:text-gray-300 max-h-40 overflow-hidden"><%= e.body_text || '' %></p>
|
||||
<% if (e.body_text && e.body_text.length > 600) { %>
|
||||
<button type="button" class="email-toggle text-xs text-blue-600 hover:text-blue-800 dark:text-blue-400 hover:underline mt-1"
|
||||
data-expanded="false">Vollständig anzeigen</button>
|
||||
<% } %>
|
||||
<% } %>
|
||||
|
||||
<% if (e.anhaenge && e.anhaenge.length) { %>
|
||||
@@ -146,6 +152,24 @@
|
||||
const cy = document.getElementById('currentYear');
|
||||
if (cy) cy.textContent = new Date().getFullYear();
|
||||
|
||||
// Size each sandboxed e-mail iframe to its rendered content. The
|
||||
// sandbox omits allow-scripts, so mail scripts never run; allow-same-
|
||||
// origin lets us measure the document height.
|
||||
function fitFrame(f) {
|
||||
try {
|
||||
var doc = f.contentDocument || (f.contentWindow && f.contentWindow.document);
|
||||
if (!doc || !doc.body) return;
|
||||
var h = Math.max(doc.body.scrollHeight, doc.documentElement.scrollHeight);
|
||||
if (h > 0) f.style.height = (h + 6) + 'px';
|
||||
} catch (e) { /* leave default height */ }
|
||||
}
|
||||
document.querySelectorAll('.email-html-frame').forEach(function (f) {
|
||||
f.addEventListener('load', function () { fitFrame(f); });
|
||||
fitFrame(f);
|
||||
setTimeout(function () { fitFrame(f); }, 400);
|
||||
setTimeout(function () { fitFrame(f); }, 1500);
|
||||
});
|
||||
|
||||
// Expand/collapse the full e-mail body for each card.
|
||||
document.querySelectorAll('.email-toggle').forEach(function (btn) {
|
||||
btn.addEventListener('click', function () {
|
||||
|
||||
Reference in New Issue
Block a user