wang000520 2014-01-23 00:45 采纳率: 0%
浏览 6156

ueditor 过滤规则写法,求高手指教!

ueditor 过滤规则写法, 就是那个可以过滤style等等的.
config 中的这个属性:filterRules

  • 写回答

1条回答 默认 最新

  • changzhongqing 2014-10-10 05:25
    关注

    //填写过滤规则

        ,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())
                  }
            }
        }() 
    
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?