mjml icon indicating copy to clipboard operation
mjml copied to clipboard

Making modifications without refreshing the page ?

Open TomAtTeam opened this issue 3 years ago • 4 comments

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

TomAtTeam avatar Nov 15 '21 15:11 TomAtTeam

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 !

Bran72 avatar Nov 29 '21 08:11 Bran72

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

TomAtTeam avatar Nov 29 '21 10:11 TomAtTeam

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)
   }
})

Bran72 avatar Nov 29 '21 10:11 Bran72

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

TomAtTeam avatar Dec 06 '21 15:12 TomAtTeam

Shouldn't be an issue anymore

artf avatar Jun 19 '23 15:06 artf