### Install Project Dependencies Source: https://github.com/unlayer/react-email-editor/blob/master/CONTRIBUTING.md Installs all necessary dependencies for the project. Run this command in the root directory for development or in the 'demo' directory to set up the demo app. ```shell npm install ``` -------------------------------- ### Run Demo Development Server Source: https://github.com/unlayer/react-email-editor/blob/master/CONTRIBUTING.md Starts the demo application server. This command enables hot module reloading and makes the demo app accessible at http://localhost:3000. ```shell npm start ``` -------------------------------- ### Install React Email Editor Source: https://github.com/unlayer/react-email-editor/blob/master/README.md Install the react-email-editor package using npm. This command adds the necessary library to your project's dependencies. ```bash npm install react-email-editor --save ``` -------------------------------- ### Basic React Email Editor Usage Source: https://github.com/unlayer/react-email-editor/blob/master/README.md Demonstrates how to integrate the EmailEditor component into a React application. It includes setting up a ref to access the editor instance and handling the 'onReady' event. The example shows how to export the HTML content of the email design. ```javascript import React, { useRef } from 'react'; import { render } from 'react-dom'; import EmailEditor, { EditorRef, EmailEditorProps } from 'react-email-editor'; const App = (props) => { const emailEditorRef = useRef(null); const exportHtml = () => { const unlayer = emailEditorRef.current?.editor; unlayer?.exportHtml((data) => { const { design, html } = data; console.log('exportHtml', html); }); }; const onReady: EmailEditorProps['onReady'] = (unlayer) => { // editor is ready // you can load your template here; // the design json can be obtained by calling // unlayer.loadDesign(callback) or unlayer.exportHtml(callback) // const templateJson = { DESIGN JSON GOES HERE }; // unlayer.loadDesign(templateJson); }; return (
); }; render(, document.getElementById('app')); ``` -------------------------------- ### Build Project Source: https://github.com/unlayer/react-email-editor/blob/master/CONTRIBUTING.md Compiles and bundles the project for publishing to npm or for deploying the demo application. This command prepares the project for production use. ```shell npm run build ``` -------------------------------- ### Run Project Tests Source: https://github.com/unlayer/react-email-editor/blob/master/CONTRIBUTING.md Executes the project's test suite. Provides options for running tests once, generating a coverage report, or running tests continuously on file changes. ```shell npm test npm run test:coverage npm run test:watch ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.