GrapesJS / mjml

Newsletter Builder with MJML components in GrapesJS

Home Page:http://grapesjs.com/demo-mjml.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Listen Import Event, dont work editor.on('run:mjml-import:change'

karlitaviky811 opened this issue · comments

Hi, I'm using the latest version of grapesjsmjml and this solution doesn't work for me. I need to listen to the event when importing, can someone help me?

try this solution, but it doesn't work #104

Hi
Have you tried to look at the doc in this link
https://grapesjs.com/docs/api/commands.html#available-events

Maybe its like this

editor.on('stop:mjml-import:before', (mjml) => {
  console.log(mjml);
})

I'm also trying to use this.editor.runCommand('mjml-get-code').html to get the generated html, but it doesn't work for me either. Please help me to know how to access html and css ?

Try the proposed solution, but it is not importing the mjml code. I need to listen to the event and have access to the mjml code I'm loading.

And here for another functionality I need to access the generated html
to store it in the data base, but using this.editor.runCommand('mjml-get-code').html doesn't work for me

Try the proposed solution, but it is not importing the mjml code. I need to listen to the event and have access to the mjml code I'm loading.

And here for another functionality I need to access the generated html to store it in the data base, but using this.editor.runCommand('mjml-get-code').html doesn't work for me

i dont know if you can listen to event when importing.
You could however after user imported you can get the mjml code with this code

var mjml = editor.runCommand('mjml-code');

and this code to get html render by mjml

var content = editor.runCommand("mjml-code-to-html").html;

Hope this solve your problem!

I also have this problem, please help me to know how I can solve it ? error_ core.mjs:7739 ERROR Error: Malformed MJML. Check that your structure is correct and enclosed in tags.

Captura de pantalla de 2023-02-15 10-56-34

the wrapper is not generating well the code initially ...

I also have this problem, please help me to know how I can solve it ? error_ core.mjs:7739 ERROR Error: Malformed MJML. Check that your structure is correct and enclosed in tags. Captura de pantalla de 2023-02-15 10-56-34

the wrapper is not generating well the code initially ...

the mjml you have is not enclose in mjml tag
Its need to be like this

<mjml>
  <mj-body>

     // the rest of your code in image

  </mj-body>
</mjml>

however, this is the code that is generated by drag and drop (just dragging to create the plant) :/. How can it initialize? because installing the library and making editor.init should generate it automatically.

however, this is the code that is generated by drag and drop (just dragging to create the plant) :/. How can it initialize? because installing the library and making editor.init should generate it automatically.

well you could capture your screen to show me because currently i dont see any errors when drag and drop the wrapper to the editor make any malformed mjml.

If I want to create a plant by drag and drop (from the beginning) I am not building the code correctly so it is sold without the initial tags

sorry but i dont really understand what you said and this issue getting a little drag out. You can contact me from telegram for further assistance https://t.me/huuhazozo.

If I want to create a plant by drag and drop (from the beginning) I am not building the code correctly so it is sold without the initial tags