Skip to content
Discussion options

You must be logged in to vote

There's no built-in variable or merge-tag feature in the editor docs that I could find, but the editor is built for exactly this kind of extension. You can add a small custom node for variables with EmailNode, which is TipTap's Node plus a renderToReactEmail() method (see "Custom extensions" and the EmailNode API reference).

A rough sketch of an inline variable node:

import { EmailNode } from '@react-email/editor/core';

const Variable = EmailNode.create({
  name: 'variable',
  group: 'inline',
  inline: true,
  atom: true,
  addAttributes() {
    return { name: { default: 'userName' }, fallback: { default: '' } };
  },
  renderHTML({ node }) {
    return ['span', { 'data-variable': node.a…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@muezz
Comment options

@CaptainAni187
Comment options

Answer selected by muezz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants