Email Campaign
Merge fields with live sample data, a real mail merge across a recipient list, and HTML rewritten so it survives an email client. Mail clients drop <style> blocks, so getEmailHTML()inlines every rule onto the element and wraps the body to a fixed width — look at the output panel to see what is actually sent.
Example code
var cfg = RTE_CreateConfig();
// The host defines its OWN fields. `sample` is what the preview shows, so a
// writer sees the finished sentence instead of a placeholder.
cfg.mergeFields = [
{ id: "recipient.name", label: "Recipient name", sample: "Ada Lovelace" },
{ id: "company.name", label: "Company", sample: "Analytical Engines Ltd" }
];
cfg.emailWrapWidth = 640;
var editor = new RichTextEditor("#editor", cfg);
editor.insertMergeField("recipient.name"); // inserts an atomic chip
editor.setMergeFieldPreview(true); // swap chips for sample values
editor.renderMergeFields(row); // one finished letter per recipient
// Mail clients drop <style> blocks, so every rule is inlined onto the element
// and the body is wrapped to emailWrapWidth. This is what actually gets sent.
var html = editor.getEmailHTML({ width: 640 });