Remove most tags and attributes not needed in this editor

This commit is contained in:
Kijin Sung 2020-07-08 19:58:10 +09:00
parent 237637b2ef
commit f471e16636

View file

@ -42,8 +42,9 @@
// Simplify HTML content by removing unnecessary tags.
var simplifyContent = function(str) {
str = String(str);
str = str.replace(/<!--(.*?)-->/g, '');
str = str.replace(/<\/?(\?xml|meta|link|font|style|script|noscript|frame|noframes)\b[^>]*?>/ig, '');
str = str.replace(/<!--(.*?)-->/gs, '');
str = str.replace(/<\/?(\?xml|meta|link|font|span|style|script|noscript|frame|noframes|(?:st1|o):[a-z0-9]+)\b[^>]*?>/ig, '');
str = str.replace(/(id|class|style|on(?:[a-z0-9]+)|Mso(?:[a-z0-9]+))="[^"]*"/ig, '');
str = str.replace(/(<\/?)div(\W)/g, '$1p$2');
return str;
};