feat: make editor extensions ssr
Draft
DA
4mo ago+2001+2001+0123456789012345678901234567890123456789-96-96-01234567890123456789
Summary by cubic
Make the email serialization pipeline SSR-capable. composeReactEmail can now render stored TipTap JSON with your extensions on any server, no Editor or DOM required, and includes a format option to skip Prettier when not needed.
-
New Features
composeReactEmail({ content, extensions })returnshtml,text, andunformattedHtml;{ editor }still works.format(defaulttrue) skips Prettier whenfalse;html === unformattedHtmlin that mode.- Serializer hooks now receive a
ComposeContext({ doc, schema, extensions });getEmailThemingaccepts either an editor or a context. - Extension resolution and schema compilation are cached by extensions-array identity; mutated arrays re-resolve; already-resolved arrays (like
editor.extensionManager.extensions) are rejected. - Added
getGlobalContentFromJSONand exportedEmailThemingResult. - Docs updated and SSR benchmarks added; output is byte-identical to editor-based exports.
-
Migration
- Update custom serializer plugins: use
contextingetNodeStylesandBaseTemplate. Legacy editor-based plugins continue working in{ editor }mode; accessing editor internals in{ content }mode throws a clear error. - When using server-side compose, pass TipTap JSON
contentand the originalextensionslist; do not mixeditorwithcontent/extensions, and do not pass pre-resolved arrays. - Prefer
format: falseon server send paths to avoid the Prettier cost.
- Update custom serializer plugins: use