I use GrapesJs and I want to update the html content of a component.
So I use the components
method of a component : cmp.components('<h1 style="text-align:left">Hello</h1>')
.
But when I retrieve the html content of my component (cmp.toHTML()
) the style is not here.
Question posted in Javascript
A very good W3school tutorial can be found here.
A very good W3school tutorial can be found here.
2
Answers
It was an issue with my grapesjs version. I was in
0.21.1
and the problem disappears using0.21.5
.You can replace cmp.components(…) with below code