easy-email-extensions
v4.16.1
Published
Email editor
Downloads
19,229
Readme
Easy-email-extensions
usage
$ npm install --save easy-email-extensions
or
$ yarn add easy-email-extensions
import React from 'react';
import { BlockManager, BasicType, AdvancedType } from 'easy-email-core';
import { EmailEditor, EmailEditorProvider } from 'easy-email-editor';
import { ExtensionProps, StandardLayout } from 'easy-email-extensions';
import 'easy-email-editor/lib/style.css';
import 'easy-email-extensions/lib/style.css';
const categories: ExtensionProps['categories'] = [
{
label: 'Content',
active: true,
blocks: [
{
type: AdvancedType.TEXT,
},
{
type: AdvancedType.IMAGE,
payload: { attributes: { padding: '0px 0px 0px 0px' } },
},
{
type: AdvancedType.BUTTON,
},
{
type: AdvancedType.SOCIAL,
},
{
type: AdvancedType.DIVIDER,
},
{
type: AdvancedType.SPACER,
},
{
type: AdvancedType.HERO,
},
{
type: AdvancedType.WRAPPER,
},
],
},
{
label: 'Layout',
active: true,
displayType: 'column',
blocks: [
{
title: '2 columns',
payload: [
['50%', '50%'],
['33%', '67%'],
['67%', '33%'],
['25%', '75%'],
['75%', '25%'],
],
},
{
title: '3 columns',
payload: [
['33.33%', '33.33%', '33.33%'],
['25%', '25%', '50%'],
['50%', '25%', '25%'],
],
},
{
title: '4 columns',
payload: [['25%', '25%', '25%', '25%']],
},
],
},
];
const initialValues = {
subject: 'Welcome to Easy-email',
subTitle: 'Nice to meet you!',
content: BlockManager.getBlockByType(BasicType.PAGE)!.create({}),
};
export default function App() {
return (
<EmailEditorProvider
data={initialValues}
height={'calc(100vh - 72px)'}
autoComplete
dashed={false}
>
{({ values }) => {
return (
<StandardLayout
categories={categories}
showSourceCode={true}
>
<EmailEditor />
</StandardLayout>
);
}}
</EmailEditorProvider>
);
}