GrapesJS / mjml

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

Making modifications without refreshing the page ? #265

Closed TomAtTeam closed 1 year ago

TomAtTeam commented 2 years ago

Hi everyone,

I have a question about GrapesJS with MJML.

When I go on this page : https://grapesjs.com/demo-mjml.html,

Let’s say I’d like to change the color of the title « My Company » and make it red.

Capture d’écran (223)

It’s working fine, the title turns to red.

Capture d’écran (224)

But then if I want to put « My Company » in bold it doesn’t work. If I wan’t to make it work I have to refresh the page and then to put it in bold.

Capture d’écran (225)

Does someone have an idea to make it work without refresh the page please and without using the style manager ?

Thank you !

Thomas

Bran72 commented 2 years ago

I'm facing this issue too, but it's when I drag a custom block 'mj-column' or 'mj-group'... Did you find any solution ? Thx !

TomAtTeam commented 2 years ago

Hi ! Unfortunately I didn't find the solution to my problem, so I can't help you on this right now... Sorry ! Thomas

Bran72 commented 2 years ago

No problem, if it could help I got this solution. I put a listener (here when I drag a specific block), and I 'refresh' the canvas by loading the current data:

this.Editor.on('block:drag:stop', (block, component) => {
   if (component.id === 'mycustomcomponent-id') {
      const data = this.Editor.storeData()
      this.Editor.DomComponents.clear()
      this.Editor.loadData(data)
   }
})
TomAtTeam commented 2 years ago

No problem, if it could help I got this solution. I put a listener (here when I drag a specific block), and I 'refresh' the canvas by loading the current data:

this.Editor.on('block:drag:stop', (block, component) => {
   if (component.id === 'mycustomcomponent-id') {
      const data = this.Editor.storeData()
      this.Editor.DomComponents.clear()
      this.Editor.loadData(data)
   }
})

Thank you very much for your help ! It worked for me !

Have a nice day !

Thomas

artf commented 1 year ago

Shouldn't be an issue anymore