Git Product home page Git Product logo

zalify / easy-email Goto Github PK

View Code? Open in Web Editor NEW
1.6K 20.0 327.0 13.22 MB

Easy Email Editor is a feature-rich, top open-source SaaS email editor based on React and MJML.

Home Page: https://email.maocanhua.cn/

License: MIT License

JavaScript 1.24% TypeScript 84.82% SCSS 2.27% CSS 2.83% HTML 8.32% Less 0.51%
email-editor mjml-editor react-email-editor email-template-editor email-builder javascript react

easy-email's Introduction

Easy email



Using TypeScript


Pro Version Announcement

We are delighted to announce that we now have a more powerful and customizable commercial version available. If it is for internal use only, then the open-source version is sufficient. However, if your editor is a critical feature, I recommend using the commercial version. Check it out here .


Introduction

Easy email is developed based on the MJML and has very good compatibility. At the same time, it can generate code through drag-and-drop editing.

Features:

  • Drag and drop editor
  • Can be converted into MJML, or generated through MJML
  • Defined custom block
  • Dynamic rendering
Video Overview
Overview

Live Demo

Check out the live demo here: email.maocanhua.cn

Pro version live demo here: demo.easyemail.pro.

Getting started

$ npm install --save easy-email-core easy-email-editor easy-email-extensions react-final-form

or

$ yarn add easy-email-core easy-email-editor easy-email-extensions react-final-form
import React from 'react';
import { BlockManager, BasicType, AdvancedType } from 'easy-email-core';
import { EmailEditor, EmailEditorProvider } from 'easy-email-editor';
import { ExtensionProps, StandardLayout } from 'easy-email-extensions';

import 'easy-email-editor/lib/style.css';
import 'easy-email-extensions/lib/style.css';

// theme, If you need to change the theme, you can make a duplicate in https://arco.design/themes/design/1799/setting/base/Color
import '@arco-themes/react-easy-email-theme/css/arco.css';

const initialValues = {
  subject: 'Welcome to Easy-email',
  subTitle: 'Nice to meet you!',
  content: BlockManager.getBlockByType(BasicType.PAGE)!.create({}),
};

export default function App() {

  return (
    <EmailEditorProvider
      data={initialValues}
      height={'calc(100vh - 72px)'}
      autoComplete
      dashed={false}
    >
      {({ values }) => {
        return (
          <StandardLayout
            showSourceCode={true}
          >
            <EmailEditor />
          </StandardLayout>
        );
      }}
    </EmailEditorProvider>
  );
}

Configuration

property Type Description
height string / number Set the height of the container
data interface IEmailTemplate { content: IPage; subject: string; subTitle: string; } Source data
children ( props: FormState,helper: FormApi<IEmailTemplate, Partial>) => React.ReactNode ReactNode
onSubmit Config<IEmailTemplate, Partial>['onSubmit']; Called when the commit is triggered manually
fontList { value: string; label: string; }[]; Default font list.
interactiveStyle { hoverColor?: string; selectedColor?: string;} Interactive prompt color
onUploadImage (data: Blob) => Promise; Triggered when an image is pasted or uploaded
autoComplete boolean Automatically complete missing blocks. For example, Text => Section, will generate Text=>Column=>Section
mergeTags Object A merge tag is a bit of specific code that allows you to insert dynamic data into emails. Like {{user.name}}, and used for preview
previewInjectData Object Dynamic data for preview, it will overwrite mergeTags.
onBeforePreview (html: string, mergeTags: PropsProviderProps['mergeTags']) => string Promise You can replace mergeTags when previewing.

Development

$ git clone [email protected]:zalify/easy-email.git
$ cd easy-email


$ pnpm install
$ pnpm run install-all
$ pnpm run dev

If you need some new features, we always welcome you to submit a PR.

License

The MIT License

easy-email's People

Contributors

alexandrdobrovolskiy avatar alexbevilacqua avatar alexmateos avatar browniefed avatar caffeei avatar carlescamig avatar danielyeh-meepshop avatar dominastorm avatar fabien-roy avatar m-ryan avatar mikicho avatar realmail-editor avatar renyuanz avatar sambegin avatar sarathjasrin avatar vskoryk avatar wilau2 avatar willopez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

easy-email's Issues

Lot of inconsistencies in Demo and Main Repo

There is a verified commit for the demo version which also has a lot of inconsistencies and mistakes as compared to the main repo.

The verified commit is: https://github.com/m-Ryan/easy-email-demo/tree/f15b96b00f25f6cec267c389c1895dad987a70ef
The main repo I am referring to is: https://github.com/arco-design/easy-email

Kindly upload the latest code on the demo as well with a verified commit.

As some things are working on the main repo while some are not working on a demo.
Looking forward to your kind response.
Thank You

Merge tags are being replaced in the link popup

Steps to reproduce:

  1. Open the editor;
  2. Place a text block;
  3. Highlight everything in the text block and click the link button;
  4. Enter {{product_list.0.url}} in the link box and click "Apply";
  5. Click the link button again;
  6. Notice that the link box now contains https://easy-email-m-ryan.vercel.app/%7B%7Bproduct_list.0.url%7D%7D instead of the entered text.

Submit programmatically

Is it possible to trigger EmailEditorProvider.onSubmit programmatically (e.g. in a custom hook) given this modified layout from the example?

<EmailEditorProvider
  autoComplete
  data={template}
  ...
  onSubmit={saveTemplate}
>
  {() => <EmailEditor height={"100vh"} />}
</EmailEditorProvider>

Mobile preview does not auto scroll to current view

While editing and then switching to desktop view, the currently edited item is still displayed on the view. On the contrary, if you switch to mobile view, it will automatically display the top of the page. It would be a great enhancement if it would display what is being edited for both, desktop and mobile.

Increase number of products in recommended product block dynamically via API

The issue is being discussed in the last thread here :
#70

The code you have provided is working as it shud be, Thank You for your help.

Now What I wanted to achieve is on selection from the drop-down, the new product is get loaded in the editor:
Like Newest product, Trending Product, Featured product
There will be a drop-down to select the product.
Kindly assist with the code, how can I do this.
Thank You

Checkbox Field

Have an example to enter the check box in the custom block?

Upload image from Localhost

Hi,
Sorry for reopening this issue,
This issue is already mentioned in : #67

I tried my best to get the result of uploading the image on the server-side, I checked the code on the main repo of how you are doing it.

I am just lost in the code and could not get any help.
What I want to achieve is the following things:
1 - When we click on the Upload Image button, the Image is get uploaded to the server
2 - Replaced Image in the Editor
3 - Show loader on the Upload Image button
4 - Provide code in the form of an object that holds the image so I can pass it to the server to store it.

I think there should be a component that we can reuse for the mentioned functionality.

Kindly assist with me code that I can use.
Looking forward to seeing the code as soon as possible.

Just to let you know I have tried my best before requesting the issue.

Thank You

preload template

Hi team,
Thanks for the amazing tool. I enjoy working with it. quite intuitive.

Could you please give a hint how can I preload the EmailEditorProvider with a predefined template?

npm run preview generate the following error

error when starting dev server:
Error: The following dependencies are imported but could not be resolved:

@/hooks/useFocusIdx (imported by /Email-Builder/example/pages/Editor/components/CustomBlocks/ProductRecommendation/Panel/index.tsx)

Are they installed?
at optimizeDeps (\Email-Builder\node_modules\vite\dist\node\chunks\dep-c1a9de64.js:73153:15)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async runOptimize (Email-Builder\node_modules\vite\dist\node\chunks\dep-c1a9de64.js:73827:48)
at async Server.httpServer.listen (Email-Builder\node_modules\vite\dist\node\chunks\dep-c1a9de64.js:73843:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] preview: npm run lib && vite --config vite.preview.config.ts
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] preview script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

***Urgent*** 'Raw' block not working as expected

Hi,
using the latest version (@3.2.0) the Raw block is not available through ShortcutToolbar extension. Although I've added a specific category in my context, containing a component that renders a BasicType.RAW, and system renders it correctly, it still does not work as expected.

Demonstration

Following MJML native documentation for <mj-raw>, I tryed to add a basic condition:
image
image
MJML source becomes:

<mjml>
    <mj-head>

        <mj-html-attributes>
            <mj-html-attribute class="easy-email" multiple-attributes="false" attribute-name="text-color"
                text-color="#000000"></mj-html-attribute>
            <mj-html-attribute class="easy-email" multiple-attributes="false" attribute-name="font-family"
                font-family="lucida Grande,Verdana,Microsoft YaHei"></mj-html-attribute>
            <mj-html-attribute class="easy-email" multiple-attributes="false" attribute-name="font-size"
                font-size="14px"></mj-html-attribute>
            <mj-html-attribute class="easy-email" multiple-attributes="false" attribute-name="line-height"
                line-height="1.7"></mj-html-attribute>
            <mj-html-attribute class="easy-email" multiple-attributes="false" attribute-name="responsive"
                responsive="true"></mj-html-attribute>

        </mj-html-attributes>



        <mj-breakpoint width="480px" />
        <mj-attributes>

            <mj-all font-family="lucida Grande,Verdana,Microsoft YaHei" />
            <mj-text font-size="14px" />
            <mj-text color="#000000" />
            <mj-text line-height="1.7" />


        </mj-attributes>
    </mj-head>
    <mj-body background-color="#efeeea" width="600px" css-class="mjml-body">

        <mj-wrapper padding="20px 0px 20px 0px" border="none" direction="ltr" text-align="center">

            <mj-section padding="20px 0px 20px 0px" background-repeat="repeat" background-size="auto"
                background-position="top center" border="none" direction="ltr" text-align="center">

                <mj-column padding="0px 0px 0px 0px" border="none" vertical-align="top">

                    <mj-raw>
                        {% if "a" == "b" %}
                    </mj-raw>


                    <mj-text padding="10px 25px 10px 25px" align="left">
                        Make it easy for everyone to compose emails!
                    </mj-text>


                    <mj-raw>
                        {% endif %}
                    </mj-raw>

                </mj-column>

            </mj-section>

        </mj-wrapper>

    </mj-body>
</mjml>

which seems to be fine according to doc, but the text block in between is still rendered in preview and in html export also:
image

Is MJML?

This obviously means native mj-raw might be the problem. In fact I also tryed reproducing the same example in MJML live demo.
From my perspective something is not working as expected, am I missing something? An issue really similar has been opened here, but the proposed solution is not working even in the given example.
What I suggest is trying to downgrade mjml verison in your packages and verify if it does work.

Notice

Even your example is not working.

Hope for a quick solution, best regards.

Save button is missing in Demo

Kindly Add a save button code in the demo so I can reuse the code as it is to update and Edit the Email.

Kindly provide the code in the component form.
Thank you

<AutoSaveAndRestoreEmail /> Tag

Hi Ryan

This tag is not available in demo, We are moving the code from main repo to Demo repo.
When we run the command yarn dev,
In Chrome console the following error shows:
Uncaught Error: useFormState must be used inside of a

component

Same code is used, dependency has been added but not know where it is mistake.

Please provide a working code of the code in the demo repo.

Thank You

Won't build when part of a Next.js project

We are getting the below error when building with Next.js

It seems to be the mjml brower - perhaps linked to this issue

mjmlio/mjml#2173

Seems like webpack doesn't like it - though we think that the mjml-browser is already packed.

Any ideas what the issue might be?

Many Thanks

email-engine-ui:build: info  - Loaded env from /Users/timbrown/Documents/development/github/email-engine/apps/ui/.env.local
email-engine-ui:build: info  - Checking validity of types...
email-engine-ui:build: info  - Creating an optimized production build...
email-engine-ui:build: (node:48420) [DEP_WEBPACK_MODULE_UPDATE_HASH] DeprecationWarning: Module.updateHash: Use new ChunkGraph API
email-engine-ui:build: (Use `node --trace-deprecation ...` to show where the warning was created)
email-engine-ui:build: info  - Compiled successfully
email-engine-ui:build: info  - Collecting page data...
email-engine-ui:build: 
email-engine-ui:build: > Build error occurred
email-engine-ui:build: ReferenceError: window is not defined
email-engine-ui:build:     at Object.<anonymous> (/Users/timbrown/Documents/development/github/email-engine/apps/ui/node_modules/mjml-browser/lib/index.js:1:230)
email-engine-ui:build:     at Module._compile (node:internal/modules/cjs/loader:1101:14)
email-engine-ui:build:     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
email-engine-ui:build:     at Module.load (node:internal/modules/cjs/loader:981:32)
email-engine-ui:build:     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
email-engine-ui:build:     at Module.require (node:internal/modules/cjs/loader:1005:19)
email-engine-ui:build:     at require (node:internal/modules/cjs/helpers:102:18)
email-engine-ui:build:     at Module.<anonymous> (/Users/timbrown/Documents/development/github/email-engine/apps/ui/node_modules/easy-email-core/lib/index.cjs.js:1:677)
email-engine-ui:build:     at Module._compile (node:internal/modules/cjs/loader:1101:14)
email-engine-ui:build:     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10) {
email-engine-ui:build:   type: 'ReferenceError'
email-engine-ui:build: }

数据未实时更新

拖拽多个text文本,修改时会视图数据改变,但json数据不变的情况
image

Color picker doesn't work on Safari

Tbe color picker doesn't apply it's changes to text on safari. It works on chrome. It seems like the selection isn't recognised

This is also an issue for bold, italics and so forth - all of which appear to haver the same route cause

Context tool bar doesn't have a font-height function

It looks like the line-height option in the toolbar is working as font height. People got confused about that and thought they couldn't change the font height

Could we consider renaming line-height to font-height and perhaps changing the icon

Attache screenshot to illustrate which toolbar element I mean

lineheight

Responsive issue

You have fix min-width 1400px in email builder. I have opened in small screen laptop but not responsive

Attempted import error: 'BlocksMap' is not exported from 'easy-email-editor'.

I installed this into my react project I was following the documentation but when I tried to run it. I got
Failed to compile.

./src/App.js
Attempted import error: 'BlocksMap' is not exported from 'easy-email-editor'.

I went to node modules and I found easy-email-editor folder inside that I was unable to find it. It's missing from the default exports. Did you guys replaced it with another name?

Missing License File

Hey, this project looks amazing! Congrats.

The project readme mentions that this project is MIT licensed, but I can't find the license file in the repo. I'm assuming that you forgot to add the license file?

Override default images

Is it possible to override images from the IMAGE_LIST, e.g. so that the picture component is displayed with a different image in the edit area by default?

Missing Export etc.

Hello, I installed the app accordingly to your installation procedure but the installation is missing parts, that I see in the Demo version, as there are.

  1. I do not have any menu in the editor (the icons on top of the canvas).
  2. I do not have the buttons Export html, Send Test Mal and Save. How can I achieve these?

Thank you in advance.

Stefan

Custom Block issue

In custom block not create using Section, Column and Image
Kindly provide the latest example using Section Column And Image. We are using your Nov 28 verified Commit

git clone [email protected]:arco-design/easy-email.git $ cd easy-email $ yarn install-all 报错

error https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.177.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: "ENOENT: no such file or directory, open '/Users/bytedance/Library/Caches/Yarn/v6/npm-@types-lodash-4.14.177-f70c0d19c30fab101cad46b52be60363c43c4578-integrity/node_modules/@types/lodash/fp/fromPairs.d.ts'"
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
error https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.33.0.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: "ENOENT: no such file or directory, stat '/Users/bytedance/Library/Caches/Yarn/v6/npm-@typescript-eslint-experimental-utils-4.33.0-6f2a786a4209fa2222989e9380b5331b2810f7fd-integrity/node_modules/@typescript-eslint/experimental-utils/_ts3.4/dist/ts-eslint/Scope.d.ts'"
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
[#####################################################################] 913/916lerna ERR! yarn exited 1 in 'easy-email-editor'
lerna ERR! yarn exited 1 in 'easy-email-editor'
lerna WARN complete Waiting for 2 child processes to exit. CTRL-C to exit immediately.
error Command failed with exit code 1.

Handlebars HTML-escaping

Is it possible to tweak some of the merge tags to insert the "triple-stash" symbol {{{ instead of the "double-stash" {{? Triple stash is used by Handlebars to insert raw HTML.

InteractivePrompt scroll issues

When editor is placed in a page which height overflows, the focus tooltip does not stay attached to its focused element. In fact it does scroll with page since it has position: fixed.
A solution may be to set its position: absolute and make its parent position: relative setting left: 0 and top: -$label-height, but as I've seen this is not enough when the tooltip should be placed over the preview bar beacuse it is in another DOM and z-index does not apply.

interactive-prompt

Can you try to fix this?

Best regards

error on build application

Hi,
I started all over to install easy-email, installation went fine, but on npm run build, I get this error:

easy email

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.