GrapesJS / mjml

Newsletter Builder with MJML components in GrapesJS
http://grapesjs.com/demo-mjml.html
BSD 3-Clause "New" or "Revised" License
637 stars 227 forks source link

[Feature Request] a way to provide a parser override #113

Closed DRoet closed 1 month ago

DRoet commented 5 years ago

Hi,

Since mjml4-in-browser is only being used to compile the mjml -> html, I was wondering if there is a way to create an override to the current parse method, to allow users to compile the mjml on the server instead.

something like:

const editor = grapesjs.init({
  fromElement: 1,
  container : '#gjs',
  plugins: ['grapesjs-mjml'],
  pluginsOpts: {
    'grapesjs-mjml': {
      parser: async function (mjml) {
        const res = await axios.post("/parser", {
          mjml: mjml
        })
        // this returns the html
        return res.data
      }
    }
  }
});

pros:

cons:

I don't have any experience with the grapesjs internals so I was just wondering if building something like this is even possible, @artf thoughts?

larsdecker commented 5 years ago

I like the idea. I will look at the code and check if we can provide an option for it.

artf commented 1 month ago

https://github.com/GrapesJS/mjml/pull/341