0.0.0-alpha.5.hot-fix.1 • Published 2 years ago
dnd-email-editor v0.0.0-alpha.5.hot-fix.1
Installation
# Yarn
yarn add dnd-email-editor
# NPM
npm install dnd-email-editor
What's included
Editor includes these api's
getHtml
- export the design as html contentgetJson
- export as json string, this string can then be used withloadJson
loadJson
- load an existing design from json string
Usage
- Importing
import Editor from 'dnd-email-editor';
return <Editor />;
- Setup a
ref
usinguseRef
and pass it to editor
const ref = React.useRef(null);
return <Editor ref={ref} />;
- Using
getHtml()
,getJson()
andloadJson()
const logValues = () => {
if (ref.current) {
const html = ref.current.getHtml();
const json = ref.current.getJson();
console.log(html, json);
}
};
const loadJson = (json: string) => {
if (ref.current) {
ref.current.loadJson(json);
}
};
- Typescript
Inorder to use typescript and get cool definitions, just pass the type to the ref
import Editor from 'dnd-email-editor';
const ExampleComponent = () => {
- const ref = useRef(null);
+ const ref = useRef<Editor>(null);
return (
<Editor ref={ref}/>
);
}
Purpose
There are soo many drag and drop editors that helps in creating website but not mails, because mails differ a lot from `a normal html webpage'
- even if there are
mail editors
available, they are paid and notopen-source
.
One such example would be unlayer
, It claims to be opensource but its not.
- Looking at their source code, they only provide their loader-script and call it as
open-source
- later they ask you to pay for its features.
the above reasons and also I was inspired by drag-n-drop editors in general, so I decided to make one.
Features
- Responsive and mobile friendly emails
- Design emails by drag and drop
- Import/Export designs
- Export/Import as JSON
- Export as HTML
- Manage Fonts
- add custom fonts
- list / add/ deletefonts
- Go back and forth with
Undo / Redo
- Preview the design in the browser (Mobile & PC)
Built with
Inspired by
0.0.0-alpha.4
2 years ago
0.0.0-alpha.5.hot-fix.1
2 years ago
0.0.0-alpha.5
2 years ago
0.0.0-alpha.3
3 years ago
0.0.0-alpha.2.build.6
3 years ago
0.0.0-alpha.2.build.5
3 years ago
0.0.0-alpha.2.build.4
3 years ago
0.0.0-alpha.2.build.3
3 years ago
0.0.0-alpha.2.build.2
3 years ago
0.0.0-alpha.2
3 years ago