Issue #2460Opened December 20, 2019by suchiitsme2 reactions

Convert & to &amp; < 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)

pouyamiralayiDecember 21, 20191 reactions

@suchiitsme

 editor.on('storage:start:store', o => {
        o.html = o.html.replace(/&/gi,'&amp')
        o.html = o.html.replace(/</gi,'&lt')
        o.html = o.html.replace(/>/gi,'&gt')
  })

cheers!

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.