Can't make the custom tool work
Following this tutorial: https://examples.unlayer.com/custom_tools/react-custom-tool
This is what I have in the component.js:
const React = window.unlayer.React
const Viewer = () => {
return <div>I am a custom tool.</div>
}
// Custom Property Editor
unlayer.registerTool({
type: "whatever",
category: "contents",
label: "Test Tool",
icon: "fa-smile",
values: {},
options: { },
renderer: {
Viewer: Viewer,
exporters: {
web: function () {},
email: function () {}
}
}
});
My editor page:
<EmailEditor
ref={emailEditorRef}
projectId={85626}
options={{
customJS: [
`https://app.dev.localhost/custom.js`,
]
}}
/>
The error I have: custom.js:9 Uncaught SyntaxError: Unexpected token '<' (at custom.js:9:12)
What am I doing wrong?
Isn't it because it's not expecting JSX code because you provided a .js extension for a file?
@lucasbesen @umairsiddique @adeelraza
Any thoughts on this? Following the tutorial precisely leads to the error that is posted above!
I reckon it may be caused by the type attribute of the script tag being set to text/javascript instead of text/jsx. Is there any way to control the script type used for each custom tool?