...
|
...
|
@@ -18,7 +18,7 @@ const removeHtml = (str) => { |
|
|
* [html转为转义]
|
|
|
*/
|
|
|
const htmlToEscape = (html) => {
|
|
|
return html.replace(/[<>&"]/g, (e) => {
|
|
|
return (html || '').replace(/[<>&"]/g, (e) => {
|
|
|
return _htmlMap[e];
|
|
|
});
|
|
|
};
|
...
|
...
|
@@ -27,7 +27,7 @@ const htmlToEscape = (html) => { |
|
|
* [转义符转为html]
|
|
|
*/
|
|
|
const escapeToHtml = (str) => {
|
|
|
return str.replace(/&(lt|gt|nbsp|amp|quot);/g, (match, e) => {
|
|
|
return (str || '').replace(/&(lt|gt|nbsp|amp|quot);/g, (match, e) => {
|
|
|
return _EscapeMap[e];
|
|
|
});
|
|
|
};
|
...
|
...
|
|