GrapesJS / grapesjs

Free and Open source Web Builder Framework. Next generation tool for building templates without coding
https://grapesjs.com
BSD 3-Clause "New" or "Revised" License
22.37k stars 4.05k forks source link

Classes are missing on editor.gethtml() #557

Closed krunal039 closed 6 years ago

krunal039 commented 6 years ago

I can see classes are added on canvas but when I get html via editor.gethtml(), i so some of classes are not included and it is just divs without any classes. attached screenshot with html on canvas and html via editor.gethtml()

capture

arthuralmeidap commented 6 years ago

When you use the editor.getHtml it returns just the html . If you need the css too, you can use the editor.getCss().

Geczy commented 6 years ago

I use newsletter-plugin and const html = window.grapesjs.editors[0].runCommand('gjs-get-inlined-html')

krunal039 commented 6 years ago

@arthuralmeidap thanks for reply but what I meant by just html, returned html looses all css class reference, if you look at attached picture, you will see all div's class attribute is removed. but i can see class applied in canvas.

krunal039 commented 6 years ago

@Geczy I tried editor.runCommand('get-inlined-html') but it does not return anything

arthuralmeidap commented 6 years ago

As I said, the editor.getHtml() does not returns the applied css on the canvas. You will need a the editor.getCss() to get the css

Geczy commented 6 years ago

Include the newsletter plugin

krunal039 commented 6 years ago

@arthuralmeidap I am not after applied class defination(getCss() will return class defination), I am after correct html with class name applied. when I use html.getHtml() it remove some of applied classes from returned html.

I can see class applied in canvas like as I mentioned in image.

example:

canvas:

Text Content
editor.getHtml():
Text Content

Also request you to look at image attached,

Geczy commented 6 years ago

Don't think gjs- prefixed classes will return

krunal039 commented 6 years ago

@Geczy correct, it does not return classname start with gjs, I have change class name prefix and it is fine now. Thanks for quick help.

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.