You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

mailui-editor-react

Package Overview
Dependencies
Maintainers
0
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

mailui-editor-react

Email template drag and drop builder.


Version published
Maintainers
0
Created

Readme

Source

React MailUi Editor

Enhance your app with MailUi user-friendly React.js wrapper component for designing emails. Enjoy it's easy drag-and-drop editor, making email creation a breeze!

React MailUi Editor

Table of contents

Live Demo

A minimal demo page can be found in example directory.

Getting started

Installation

Install it from npm and include it in your React build process

npm install react-mailui-editor --save

OR

yarn add react-mailui-editor

Usage

Require the MailUiEditor component and render it with JSX:

import React, {useRef} from 'react';
import MailUiEditor, {MailUiEditorRef, MailUiEditorProps} from 'react-mailui-editor';

const ExampleComponent = () => {
    const ref = useRef < MailUiEditorRef > (null);

    const exportHtml = () => {
        const mailui = ref.current?.editor;

        mailui?.exportHtml((data) => {
            const {design, html} = data;
            console.log('exportHtml', html);
        });
    };

    const onReady: MailUiEditorProps['onReady'] = (mailui) => {
        // Editor is ready
        // You can load your template here;
        // The design JSON can be obtained by calling mailui.loadDesign(callback) or mailui.exportHtml(callback)

        // For example:
        // const templateJson = { DESIGN JSON GOES HERE };
        // mailui.loadDesign(templateJson);
    };

    return (
        <div>
            <div>
                <button onClick={exportHtml}>Export HTML</button>
            </div>

            <EmailEditor ref={emailEditorRef} onReady={onReady}/>
        </div>
    );
};

export default ExampleComponent;

See the example source for a reference implementation.

Methods

All MailUi methods are available in the editor instance (emailEditorRef.current.editor). See the MailUi Docs for more information, or log the object in the console to explore it. Here are the most used ones:

methodparamsdescription
loadDesignObject dataTakes the design JSON and loads it in the editor
saveDesignFunction callbackReturns the design JSON in a callback function
exportHtmlFunction callbackReturns the design HTML and JSON in a callback function

Properties

  • editorId {String} HTML div id of the container where the editor will be embedded (optional)
  • minHeight {String} minimum height to initialize the editor with (default 500px)
  • onLoad {Function} called when the editor instance is created
  • onReady {Function} called when the editor has finished loading
  • options {Object} options passed to the MailUi editor instance (default {})
  • style {Object} style object for the editor container (default {})

Browser support

MailUi supports all modern browsers. It is tested with the latest versions of Chrome, Edge, Safari, Firefox, and Opera.

The following browsers are supported out of the box in MailUi v0.0.1.beta:

  • Chrome ≥40
  • Edge ≥17
  • Safari ≥11.1
  • Firefox ≥44
  • Opera ≥27

Please be aware that the MailUi editor is currently not compatible with Internet Explorer, and there are no plans to add support for it in the future.

React

To use the latest version of MailUi editor, your project needs to use React 15.5 or later.

If you use an older version of React, please refer to the table below to a find suitable MailUi version.

React versionNewest compatible MailUi version
≥15.5latest

Localization

You can submit new language translations by creating a PR on this GitHub repo: https://github.com/MailUi/mailui-editor-translations. Translations managed by PhraseApp

License

Copyright (c) 2023 MailUi. MIT Licensed.

FAQs

Package last updated on 04 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc