feat: pluggable reply/forward quote header #295

This commit is contained in:
Linus Rath
2026-05-18 17:53:23 +02:00
parent 3d2ed71f3a
commit cf9292262d
5 changed files with 231 additions and 3 deletions
+46
View File
@@ -645,6 +645,52 @@ export interface ReplyContext {
mode: 'reply' | 'reply-all' | 'forward';
}
/**
* Second argument to onBuildQuoteHeader transform handlers. Describes the
* original message and how the host plans to render the quote header so
* plugins can produce a replacement block (e.g. an Outlook-style
* From/Sent/To/Cc/Subject section).
*/
export interface QuoteHeaderContext {
mode: 'reply' | 'replyAll' | 'forward';
/** Recipients of the new outgoing message (already resolved by the host). */
newTo: string[];
newCc: string[];
/** Original message metadata. */
from: { name?: string; email: string } | null;
to: { name?: string; email: string }[];
cc: { name?: string; email: string }[];
subject: string;
/** Pre-formatted date string the host already produced (locale-aware). */
date: string;
/** Raw ISO datetime, in case the plugin wants to reformat. */
receivedAt?: string;
/** Active UI locale (BCP-47), useful for Intl.DateTimeFormat in plugins. */
locale: string;
}
/**
* Initial value for the onBuildQuoteHeader transform hook. Plugins return a
* replacement; returning undefined falls through to the next handler or the
* default. The composer splices `html` into HTML drafts and `text` into
* plain-text drafts.
*
* For HTML, returning a header that includes its own surrounding wrapper
* (`<div>...</div>`) is fine; the composer does not add extra wrappers.
* For text, the host appends the quoted body after the header.
*/
export interface QuoteHeader {
html: string;
text: string;
/**
* When false, the composer skips its default blockquote wrapping around the
* quoted body (HTML mode only). Use this for the Outlook style where the
* quoted message is intended to follow the header without indentation.
* Defaults to true (preserve the existing blockquote wrapping).
*/
wrapInBlockquote?: boolean;
}
/**
* Describes an attachment crossing an attachment hook (upload, download, preview).
*/