Custom tool configuration (for exporter in custom.js) does not work

This issue has been tracked since 2022-05-14.

We are attempting to configure the email exporter for a custom tool (which I've created in the Unlayer web dashboard). I've followed the directions in the documentation for configuring the tool in a custom.js file and am passing that file into the email editor component as a property, however it's not working as expected.

The component renders correctly however the configuration for the exporter does not get applied. I'm including a console.log statement at the top of the custom.js file which never gets executed in the browser (see screenshot below).

<EmailEditor
  customJS={"http://lvh.me:3000/unlayer/custom.js"}
  displayMode='email'
  onLoad={onLoad}
  options={{ mergeTags }}
  minHeight={700}
  projectId="XXXXX" // We're using a valid project id for a business account
  ref={emailEditorRef}
  tools={{
    'custom#barcode': {
      properties: {
        Type: {
          editor: {
            data: {
              options: [{
                label: 'Option 1',
                value: 1,
              }, {
                label: 'Option 2',
                value: 2,
              }]
            }
          }
        }
      },
    },
  }}
/>
// This file is served at http://lvh.me:3000/unlayer/custom.js

console.log('Inside custom.js') // this line is never executed

window.unlayer.registerTool({
  name: 'barcode',
  renderer: {
    exporters: {
      email: function() {
        return `<div>Barcode tool</div>`
      }
    }
  }
});

Screen Shot 2022-05-14 at 3 06 45 PM

Screen Shot 2022-05-14 at 3 07 09 PM

nhippenmeyer wrote this answer on 2022-05-17

Resolved. customJS needs to be passed in as an option, not a property on the react component:

<EmailEditor
  displayMode='email'
  onLoad={onLoad}
  options={{
    customJS: "http://lvh.me:3000/unlayer/custom.js",
    mergeTags
  }}
  minHeight={700}
  projectId="XXXXX" // We're using a valid project id for a business account
  ref={emailEditorRef}
  tools={{
    'custom#barcode': {
      properties: {
        Type: {
          editor: {
            data: {
              options: [{
                label: 'Option 1',
                value: 1,
              }, {
                label: 'Option 2',
                value: 2,
              }]
            }
          }
        }
      },
    },
  }}
/>```
More Details About Repo
Owner Name unlayer
Repo Name react-email-editor
Full Name unlayer/react-email-editor
Language JavaScript
Created Date 2017-10-01
Updated Date 2022-12-05
Star Count 3598
Watcher Count 48
Fork Count 627
Issue Count 163

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date