问题描述
- ueditor 过滤规则写法,求高手指教!
-
ueditor 过滤规则写法, 就是那个可以过滤style等等的.
config 中的这个属性:filterRules
解决方案
//填写过滤规则
,filterRules: function(){
function transP(node)
{
node.tagName = 'p';
node.setStyle();
}
return {
'-' : 'script style object iframe embed input select',
'p': {$:{'style':1}},
'img':{$:{'style':1,'src':1}},
'br':{$:{}},
'div':{'br':1,'BR':1,'$':{'id':1,'style':1}},
'li':{'$':{'style':1}},
'ul':{'$':{'style':1}},
'a':{'$':{'style':1}},
'caption':transP,
'th':transP,
'tr':transP,
'h1':transP,'h2':transP,'h3':transP,'h4':transP,'h5':transP,'h6':transP,
'td':function(node)
{
var txt = !!node.innerText();
if(txt)
{
node.parentNode.insertAfter(UE.uNode.createText(' '),node);
}
node.parentNode.removeChild(node,node.innerText())
}
}
}()
时间: 2024-10-24 18:51:44