Preserve <br> for empty paragraphs

This commit is contained in:
Kijin Sung 2020-07-08 19:05:36 +09:00
parent 9b69cd2aca
commit e448c7a529

View file

@ -36,8 +36,7 @@
str = String(str);
str = str.replace(/<!--(.*?)-->/g, '');
str = str.replace(/<\/?(\?xml|meta|link|font|style|script|noscript|frame|noframes)\b[^>]*?>/ig, '');
str = str.replace(/<br\s*\/?>/g, '').replace(/(<\/?)div(\W)/g, '$1p$2');
str = str.replace(/<p>\s*<\/p>/g, '<p>&nbsp;</p>');
str = str.replace(/(<\/?)div(\W)/g, '$1p$2');
return str;
};