@markopolo_ai_inc/markopolo-email-editor
v1.0.7
Published
React email template editor (drag-and-drop blocks, export HTML/JSON). Built with Create React App; library build via Rollup.
Readme
@markopolo_ai_inc/markopolo-email-editor
React email template editor (drag-and-drop blocks, export HTML/JSON). Built with Create React App; library build via Rollup.
Using the published package
Install the package and its peer dependencies in your app:
npm install @markopolo_ai_inc/markopolo-email-editor react react-dom antd @fortawesome/fontawesome-svg-core @fortawesome/free-solid-svg-icons @fortawesome/react-fontawesome framer-motion react-color clsx axiosThen import the component and the CSS (required for correct styling):
import EmailEditor from '@markopolo_ai_inc/markopolo-email-editor';
import '@markopolo_ai_inc/markopolo-email-editor/lib/index.css';
// Use <EmailEditor defaultBlockList={...} defaultBodySettings={...} language="en" />Use the component’s ref to call exportHtml() or read blockList / bodySettings as needed.
Available Scripts (developers)
Two main flows (like @editex/react-email-editor):
Flow 1 – Build the library (for npm publish)
npm run build:lib– Builds the email editor as a library with tree-shaking (Rollup). Output:lib/only (index.js,index.mjs,index.css). This is what gets published to npm; the repo is not pushed, onlylib/andREADME.md.
Flow 2 – Local development server
npm run devornpm start– Runs the full app in development mode at http://localhost:3000. Use this for day-to-day development.
In the project directory you can also run:
npm start
Runs the app in the development mode.
Open http://localhost:3000 to view it in your browser.
The page will reload when you make changes.
You may also see any lint errors in the console.
npm test
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
npm run build
Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.
npm run eject
Note: this is a one-way operation. Once you eject, you can't go back!
If you aren't satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
You don't have to ever use eject. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
Install dependencies: run npm install in the project directory before using the scripts above.
Email template: JSON to HTML
The editor exports template JSON (blocks + theme settings). Use exportNormalizerToHtml to turn that JSON into a complete HTML document (e.g. for file download or iframe).
Sample flow:
import { exportNormalizerToHtml } from "../components/EmailEditor/utils/dataToHTML";
// From string (e.g. file content or API)
const htmlString = exportNormalizerToHtml(jsonString);
// From object (e.g. defaultBlockList.json or exported template)
const htmlString = exportNormalizerToHtml({ blockList, bodySettings });
// Save as file or use in iframe, etc.
const blob = new Blob([htmlString], { type: "text/html" });dataToHtml is the default export; exportNormalizerToHtml is a named export for this JSON → full HTML flow.
