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.36k stars 4.05k forks source link

grapesjs strips   entities (mostly inserted by CKEditor) #1915

Closed arachnosoft closed 5 years ago

arachnosoft commented 5 years ago

Hi @artf ,

We have just noticed that, if you import this code into grapesjs:

` 

` With an ` ` between the two label tags, the ` ` is being stripped from the code, leaving the two
artf commented 5 years ago

I think the issue might be here https://github.com/artf/grapesjs/blob/0a122cd7b558bcf391cfd7e4608dffad3ba9de53/src/parser/model/ParserHtml.js#L169-L172 unfortunately nodeValue returns already processed string, without   Try to use this option: https://github.com/artf/grapesjs/blob/0a122cd7b558bcf391cfd7e4608dffad3ba9de53/src/editor/config/config.js#L104-L105

arachnosoft commented 5 years ago

Thank you very much for the tip @artf , this (undocumented?) Parser config option seems to solve my issue! Of course, I had to set it to true, not 0, as I wanted to keep those empty spaces ;)

And had to set it on the editor.Parser.getConfig() object. Setting this option through grapesjs.init() has no effect.

keepEmptyTextNodes Initialization keepEmptyTextNodes Usage

I'm closing the issue! But you should add this on your documentation ;)

lock[bot] commented 4 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.