email-editor to edit email templates. I am able to save template data in html format.As react-email-editor is loading data in json format .My question is how can I save that html data into JSON format and load into my editor.Or if there any other package to design email templates in react
import React, { useRef } from 'react';
import { render } from 'react-dom';
import EmailEditor from 'react-email-editor';
const App = (props) => {
const emailEditorRef = useRef(null);
const exportHtml = () => {
emailEditorRef.current.editor.exportHtml((data) => {
const { design, html } = data;
console.log('exportHtml', html);
});
};
const onLoad = () => {
// editor instance is created
// you can load your template here;
// const templateJson = {};
// emailEditorRef.current.editor.loadDesign(templateJson);
}
const onReady = () => {
// editor is ready
console.log('onReady');
};
return (
<div>
<div>
<button onClick={exportHtml}>Export HTML</button>
</div>
<EmailEditor ref={emailEditorRef} onLoad={onLoad} onReady={onReady} />
</div>
);
};