How to save
For full code, check out our live demo
We usually need to save the changed email template to the database
Editor.tsx
const onSubmit: ThemeConfigProps["onSubmit"] = async (values, editor) => {
console.log(values, editor);
};
const config = Retro.useCreateConfig({
...
onSubmit: onSubmit,
});
EditorHeader.tsx
const { submit, dirty } = useEditorContext(); // Please note that useEditorContext can only be called under EmailEditorProvider (restriction of React context)
// When you call submit, the onSubmit method will be triggered.
<Button disabled={!dirty} onClick={() => submit()}>
<strong>Submit</strong>
</Button>;