Ueditor编辑器 自动过滤Style内联样式问题
UE.plugins['defaultfilter'] = function () { var me = this; me.setOpt({ 'allowDivTransToP':false, 'disabledTableInTable':true });
2、修改过滤规则
将 case style 与script 注释掉
root.traversal(function (node) { if (node.type == 'element') { if (!dtd.$cdata[node.tagName] && me.options.autoClearEmptyNode && dtd.$inline[node.tagName] && !dtd.$empty[node.tagName] && (!node.attrs || utils.isEmptyObject(node.attrs))) { if (!node.firstChild()) node.parentNode.removeChild(node); else if (node.tagName == 'span' && (!node.attrs || utils.isEmptyObject(node.attrs))) { node.parentNode.removeChild(node, true) } return; } switch (node.tagName) {// case 'style':// case 'script':// node.setAttr({// cdata_tag: node.tagName,// cdata_data: (node.innerHTML() || ''),// '_ue_custom_node_':'true'// });// node.tagName = 'div';// node.innerHTML('');// break;
二、修改ueditor.config.js
以下三项配置全部改为false
// xss 过滤是否开启,inserthtml等操作 ,xssFilterRules: false //input xss过滤 ,inputXssFilter: false //output xss过滤 ,outputXssFilter: false
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。