Convert & to & < to $lt; and save html data
Question
Im using editor and generating a html string and saving it to a file. But before saving I have to encode all the &, <, > characters.
Please Help
Answers (2)
@suchiitsme
editor.on('storage:start:store', o => {
o.html = o.html.replace(/&/gi,'&')
o.html = o.html.replace(/</gi,'<')
o.html = o.html.replace(/>/gi,'>')
})
cheers!
In the next release, we'll escape HTML characters https://github.com/artf/grapesjs/pull/2446
Related Questions and Answers
Continue research with similar issue discussions.
Issue #605
How we can save HTML
How we can save HTML without using editor.getHtml() and replace function. As, when we are using this in image upload then the existing vide...
Issue #778
save to db data-gjs-droppable
Hi guys, I need to solve a problem. Saving html grapejs strip all data-gjs- from html. Exists a way to maintain all data-gjs- before save e...
Issue #1993
[QUESTIONS] is any way to store the html id with its component when i click save button
Hi. I know the grapesjs will generate the unique id for each HTML. when I store that HTML and CSS. the HTML id is not stored in my database...
Issue #911
Could some one please help me with Custom Load.
What I can use instead of followings- editor.setHtml( arrdata['html'] ), editor.setCss( arrdata['css'] ), In below code.
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.