npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mailui-editor-react

v0.4.19

Published

Email template drag and drop builder.

Downloads

273

Readme

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.

  • Live demo link: https://app.mailui.co/create/blank
  • Source Code: https://github.com/MailUi/react-mailui-editor/tree/master/example

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

React installation

npm i mailui-editor-react@latest
import MailUiEditor from "mailui-editor-react";

<MailUiEditor
    onReady={(mailui) => mailui.loadDesign({})}
        options={{
        projectId: ‘‘,
        signature: ““
    }}
/>

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:

| method | params | description | | -------------- | ------------------- | ------------------------------------------------------- | | loadDesign | Object data | Takes the design JSON and loads it in the editor | | saveDesign | Function callback | Returns the design JSON in a callback function | | exportHtml | Function callback | Returns 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 version | Newest compatible MailUi version | | ------------- | -------------------------------- | | ≥15.5 | latest |

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.