GithubHelp home page GithubHelp logo

unlayer / react-email-editor Goto Github PK

View Code? Open in Web Editor NEW
4.4K 54.0 714.0 2.45 MB

Drag-n-Drop Email Editor Component for React.js

Home Page: https://unlayer.com/embed

License: MIT License

JavaScript 9.84% TypeScript 90.16%
email-template email-marketing html-email html-emails drag-and-drop react-component builder email-builder template email

react-email-editor's People

Contributors

adeelraza avatar ayushmanchhabra avatar brunolemos avatar dependabot[bot] avatar jtsui avatar junaidaziz avatar lucasbesen avatar lukasgjetting avatar novacoole avatar otaviosoares avatar umairsiddique 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  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

react-email-editor's Issues

saveDesign / exportHtml not invoking the callback with the email data

Hi
I have just installed the latest version of react-email-editor.
Initializing the email editor working fine, however when i try to log the json / html output of the email it does not invoke my callback methods passed to saveDesign / exportHtml methods. There are no errors in the browser console either.

Can someone please help?
Below is some sample code that i am using to print the data

saveDesign = () => {
// this is logged in console
console.log('inside saveDesign');
this.editor.saveDesign((data) => {
// DOES NOT COME HERE
console.log(data);
});
// this gets logged, means the method is called fine
console.log("Design JSON has been logged in your developer console.")
}

exportHtml = () => {
// this is logged in console
console.log('inside exportHtml');
this.editor.exportHtml(data => {
// DOES NOT COME HERE
const { design, html } = data
console.log('exportHtml', html)
})
// This gets logged fine
console.log("Output HTML has been logged in your developer console.");
}

React version i am using is 16.6.3

OnLoad function call

Hey guys, Im unable to load JSON design via onLoad prop. However, I am able to load JSON manually using the same function called by the onLoad prop by pressing the load button once the editor is loaded. Below is my code an error message.
Im loading in the JSON via redux but I make sure the template json data is defined before rendering EmailEditor.

class Template extends Component {
  componentDidMount () {
    Promise.resolve (this.props.getTemplate ('emaily'));
  }
  loadDesign = () => {
    this.editor.loadDesign (this.props.template);
  }
  render () {
    return (
         // manual load button
        <button onClick={() => this.loadDesign ()} className="btn right">
            load
        </button>
        <EmailEditor
          onLoad={() => this.loadDesign()}
          //or
          //onLoad={this.loadDesign}}
          ref={editor => (this.editor = editor)}
        />
      </div>
    );
  }
}

function mapStateToProps (state) {
  return {template: state.template.currentTemplate};
}
export default connect (mapStateToProps, actions) (TemplateRF);

Error message if .....onLoad={this.loadDesign}
Uncaught (in promise) Error: Minified

Error message if .....onLoad={() => this.loadDesign()
Uncaught TypeError: Cannot read property 'get' of undefined
at editor.js:2
at l.configureFinalMapState (editor.js:2)
at l.computeStateProps (editor.js:2)
at l.updateStatePropsIfNeeded (editor.js:2)
at l.render (editor.js:2)
at d._renderValidatedComponentWithoutOwnerOrContext (editor.js:2)

S3 Integration

Is there a way to change the S3 credentials that are used with this? I am not seeing a way to send that.

1 mb upload limit even if it to anther server

Hey, Is there any way to cancel the limitaion on uploading an image, to another storge?
Now, If I try to upload an image to my storge it gives me this error message : "There was an error uploading your image. Make sure it's a valid image file with size under 1 MB."

Make Mixpanel Opt In

Would you all consider making mixpanel opt-in. Those of us needing to comply with GDPR need full control over what data about our users is sent to third parties.

Custom tools

Hi guys,

sorry for writing this question here, but your support didn't answer me.

I'm trying to create a custom tool, but I can't understand how to make "contenteditable" work with tool's properties.

Is it possible at all?

Best wishes,

Dmytro.

On design load is called infinitely

Trying to figure out why onDesignLoad is being called a gazillion times.

screen shot 2018-08-20 at 12 32 47 am

Code is after loading persisted json into the editor and used in the exact same way as the demo code.

        <EmailEditor
          ref={editor => this.editor = editor}
          onLoad={this.onLoad}
          onDesignLoad={() => this.onDesignLoad()}
        />
  onDesignLoad = () => {
    const { json } = t
    const parsedJson = JSON.parse(json)

    console.log('on design load called')

    this.editor.loadDesign(parsedJson)
  }

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.

I am opening this issue because this is still not working with me on React 16. The exact same code was working fine on React 15. I am on

"react": "^16.3.2"
"react-dom": "^16.3.2",
"react-email-editor": "^0.8.1",

and i keep getting this error even with the sample README code:
Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.

Vertical scroll in template editor body

The editor template body has a padding that brings a vertical scroll behaviour:

vertical scroll

I personally think the template editor would become more enjoyable to use without that vertical scroll.

Row/column background issue

Hey guys,

I've found a very strange bug in your plugin.

If you add a row, but do not specify anything for it at all, the generated design will be broken. It means, that if you try to load this design, plugin will work BUT if you will try to click on that new row - plugin will crash.

Here is the screenshot of console and errors I've got:
https://monosnap.com/file/NoHzuRxiaWYZ4oghgU7IQjurNkgj5y

While debugging and trying to find the real issue, I've made a conclusion, that you are trying to detect the background color's scheme (RGB, HEX etc.) and it fails if you do not specify row (or column) background at all after adding new row, because backgroundColor and columnsBackgroundColor values are null.

Looking forward for the fix,
Dmytro.

move styled-components to peerDependencies

We're running 2 conflicting versions of styled-components, due to it being a hard dep. Could you move it to peerDependencies? You don't use any legacy APIs. You could opt for 2.x || 3.x as well.

Resizing Images

Hi,

I've seen some comments posted here on this already, but we could really use the ability to resize images within the Email editor. I see within the "Web" editor that there is a size-width option; we'd like something similar to this to appear on the email view of the app - but actually be able to re-size, as it appears even the "web" option is just really for making the image smaller if needed by adding padding. This is really crucial for our users to be able to make seamless content without having to back out of the app and resize images manually.

Any possible ETA on a feature like this?

[Feture request] Add image select button

It is nice if this editor has select existing image future on Image Uploader property.

Currently, if you want to use an existing image, you must input the image URL manually.

My idea is here.

unlayer.registerCallback('selectimage', function(done) {
  openImageSelector()
    .selected(function(e) {
      done({
        url: e.publicUrl,
        alternateText: e.alternateText,
      });
    });
});
  • If register selectimage callback, Select Image button appears on the Image Uploader property.
  • If the user click Select Image button, image selector displayed
  • If the user selects some image, the done function called and image URL replaced to selected image URL.
  • If the user cancels to select the image, nothing to do

Size of an Uploaded Files

Hello everyone, tell me please if there is a way to set max or min size of an uploaded files in editor. I would be grateful for any suggestions. Thank you :)

embed.bundle.js unavailable

The server was unable to fetch the https://designer.unroll.io/assets/embed.bundle.js , it seems that the server was done.

GET https://designer.unroll.io/assets/embed.bundle.js net::ERR_ABORTED
When I tried the URL, I got Heroku application error. I hope unroll service is reliable with long-term support since I'm planning to integrate it in a commercial app.

Design Tags in Color Picker

I'm trying to use Design Tags to replace colors on button components already in place on a template. Since the property editor doesn't allow non-hex value, I tried replacing the color with a design tag directly in the JSON. However, design tags are not replaced by the value passed in the options.

Specific Versioning

Would it be possible to potentially add in a versioning parameter into Unlayer to ensure that any updates to the product are not automatically propagated out to implementations that are already using it? For example, we may as developers want to communicate to our users that these changes are in place before they're released so that we can facilitate training or something similar.

Edit border of content

Hello, I have had a template like this image. How can I add a feature which is allow user to customize width and color of the border of content?

Please! Help

custom tags for Template

I am trying to write a custom tool on the Unlayer Dashboard. I need the toll to use a custom tag I have defined in my Django environment and I need Unlayer to spit HTML for it so my email engine can inject the right content. I need something like:

{% custom_items count={{count_property}} as items %}
{% for item in items %}
  <li>{{item.name}}</li>
{% endfor %}

But obviously custom_items is not a valid tag in Nunjucks and I don't think I can assign with as items. Is there anything that can be done to achieve this ?

import using Webpack breaks application

I followed the installations steps and as soon as I import EmailEditor into one of my components:

import React from 'react';
import EmailEditor from 'react-email-editor';

I get an error:

Uncaught TypeError: Object(...) is not a function
    at Object.<anonymous>

my env:

  "dependencies": {
    "prop-types": "^15.6.0",
    "react": "^16.0.0",
    "react-email-editor": "^0.9.0",
    "react-load-script": "0.0.6",
    "styled-components": "^4.1.2"
  }

Any idea what could be causing this bad import/export ?

is setMergeTags() available for the EmailEditor react component?

Hi guys,

Likely a noob question, but can I setMergeTags() onLoad if I am using react-email-editor?

My emailEditor div:

<div> <EmailEditor onLoad={this.onLoad} ref={editor => this.editor = editor} /> </div>

My onLoad function:

onLoad = () => { this.editor.loadDesign(this.state.designJson); this.editor.setMergeTags([ {name: "First Name", value: "{{first_name}}"}, {name: "Last Name", value: "{{last_name}}"} ]); }

Says setMergeTags is not a function.

Thanks in advance for your help.

The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'

Hello,

I opened the email template this morning and I saw in the browser console this error:

The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'

This is a screenshot to see clearly what is happening.

Can you please tell me what is going on? Are you making updates to unlayer now and that's why the error show up?

Changing the builder blocks

Hi, thanks for the work!
I was wondering if there is any way to change the builder blocks code. I would like to make pdfs out with this drag and drop editor, so it needs some changes. My idea is that maybe it is possible if the builder blocks output different code.

Thanks!

Persistentfk

Color picker cut off for text component

When attempting to change the color of text content at the bottom of an email in the editor, the color panel does not detect that it is cut off, despite merge variables and font size/family dropdowns moving up when possibly cut off.

image

No Event Listeners Working

I'm trying to get the event listener for onMouseUp so I can automatically export the html to my state, just in case the user navigates and returns they won't have to redesign everything. The problem I'm running into is literally none of the on{EVENT} handlers are even being added. I tried going into your code, and in index.js line 85 I added a console.log like this:
index.js:

     for (
       var _iterator = Object.entries(_this.props), 
       _isArray = Array.isArray(_iterator), _i = 0,
       _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;
     ) {
        var _ref2;
        if (_isArray) {
          if (_i >= _iterator.length) break;
          _ref2 = _iterator[_i++];
        } else {
          _i = _iterator.next();
          if (_i.done) break;
          _ref2 = _i.value;
        }

        var _ref = _ref2;
        var key = _ref[0];
        var value = _ref[1];

        if (/^on/.test(key) && key != 'onLoad') {
          console.log(`adding event listener for ${key} : ${value}`) 
          // ^^ This is where the onEVENT handlers should be getting added, ^^
          // but they're not because this console.log isn't even getting called
          _this.addEventListener(key, value);
        }
      }

just to see if the onMouseUp (or onMouseOver, or any on event) would even be registered, but nothing is getting printed to the console, and all event handlers are never getting called.

registerCallback not made available

When setting up custom file storage one needs to register a callback, however the react wrapper does not expose this method, unlike others (addEventListener, loadDesign, ...).

It seems to be just a matter of adding:

registerCallback = (type, callback) => {
    unlayer.registerCallback(type, callback)
}

[Feature Request] Add onChange callback

I'm using the builder along with some other text fields as a "form" but in order to determine if the form is dirty I'd need to know if an update to the builder occurred. It would be great to expose an onChangeCallback prop. I'm sure others would want to use it to save changes automatically without clicking a button.

onChange = (html, design) => {
    this.props.setSomeFieldValue(html);
    this.props.setMyAwesomeFormDirty();
}

Thanks and great work!

v0.5.0 no longer working in Electron

Hi,
Since upgrading to v0.5.0 from v0.3.0, the react-email-editor no longer loads the editor.

In the console, I get this error :-
Not allowed to load local resource: file://editor.unlayer.com/editor.html

I'm embedding this within an electron app (v1.7.2), which, if you're unfamiliar with that environment, essentially combines node + chrome.

If I Downgrade back to v0.3.0 then everything loads up fine once more.

What has changed from v0.3.0 to v0.5.0 - I don't see any change/release history.

Any ideas on how to get the latest version to work?

Custom Tools Implementation Not Working

Hey so I'm trying to figure out how to implement a custom tool into the react component, and the link you provide takes me to the Unlayer documentation, which provides zero helpful documentation for this component. It assumes the user is using the CDN for Unlayer and has access to the unlayer global object, which makes all their documentation useless to me. I have the react-email-editor component set up in my project and working quite well, and I need to add several custom tools. I've been emailing back and forth with Unlayer Support trying to figure out how to add my own tool but the rep I talk to keeps going back to using the unlayer global object, and when I tried to patchwork a tool into the tools prop, nothing worked.

An example of how to properly use the tools prop would be amazing.

Cannot read property location of undefined

side effects of onLoad implementation

The passed wrapper prop onLoad function gets called in direct response (synchronous) to the onLoad callback of the script being loaded. This does not always guarantee that the underlying component is already loaded by then.

For example the editor can be in specific route of a react application, and load the unlayer script the first time the user gets there. If the user then navigates away from that route and comes back, the script will be loaded from the cache, therefore immediately kicking in the onLoad callback.
In the demo, the onLoad function will execute this.editor.loadDesign(sample) and in my particular case add event listeners. It then blows up saying this.editor is undefined.

Event when editor is loaded

I'm trying to load a saved design to the editor, but I'm not sure how to detect if the editor frame has been loaded so I can call the loadDesign function, I keep getting unroll is undefined.

Thank you,

minWidth fixed to 1024px

Hello - first thanks for this great wrapper, really easy to setup.

I'm unable to override the min width property of the iframe and it's getting overflown from the parent container, any idea how to fix this?

Thanks

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.