Email.
The email preset: merge tags with a sample-data preview, starter templates, and export to email-safe HTML with inlined CSS, a table layout and a plain-text part.
Try this.
- Type {{ to insert a merge tag, or use the merge tags menu
- Turn on the preview in the toolbar to see sample values
- Insert a starter template from the templates button
- Compare the export tabs: inlined HTML and a plain-text part
The code.
import { createRichTextEditor } from '@better-rich-text/core';
import { createEmailPreset, exportEmailHtml } from '@better-rich-text/presets/email';
const editor = createRichTextEditor('#editor', {
preset: createEmailPreset({
fields: [{ key: 'first_name', label: 'First name', sample: 'Robin' }],
}),
});
const { html, text, issues } = exportEmailHtml(editor, { preheader: 'This month' });