react-email-editor: BUG: `previewHtml` callback is not triggered

Hello,

I am trying to preview the html using the editor’s built in preview feature. I registered a callback for preview html this way I can use Mustache as a templating library.

const onReady: EmailEditorProps['onReady'] = unlayer => {
  unlayer.registerCallback('previewHtml', function (params: any, done: any) {
    const html = Mustache.render(params.html, data)

    done({html})
  })
}

It seems however that the callback is never called. It used to work a couple of days ago and now it doesn’t (see screenshot below). In the the screenshot you can see that [[firstName]] is not being replaced by the appropriate data. I have updated the Mustache config to look for double square brackets rather than single curly brackets so this should work.

Monosnap Localista 2024-10-01 5 pm-04-26

Thank you!

About this issue

Most upvoted comments

Hi,

Please let me know if you are passing in a “projectId” during initialization. Unlayer has just rolled out new billing plans and “Custom Preview” happens to be a paid feature now, if you are an old user and have an old workspace available you can still utilize the old “Free (Legacy)” plan feature sets.

Make sure to create a new project in one of your old workspaces at console.unlayer.com, pass in the projectId within your editor, make sure to add your live domain to “Allowed Domains” list which you can find under project->settings->deployment.

Let me know if this works