zoukankan      html  css  js  c++  java
  • UEditor无法复制的解决方法

    今天终于知道UEditor不能复制的真正原因啦,还是自己一直没有仔细研究。

    UEditor 粘贴 Excell 中的表格时报错导致无法粘贴的解决办法

        在UEditor一些版本中,如果粘贴Excell中的内容到编辑器,会粘贴不进去,打开控制台发现JS报错了。

    在ueditor.all.js:3048行报如下错误:

    Uncaught TypeMismatchError: Failed to execute 'removeAttributeNode' on 'Element': The node provided is invalid.

        看这个错误应该就能知道导致错误的原因可能是调用 removeAttributeNode的对象为null或者传进 removeAttributeNode 中的参数为null。

        定位到这行代码看一下:

     removeAttributes:function (node, attrNames) {
            attrNames = utils.isArray(attrNames) ? attrNames : utils.trim(attrNames).replace(/[ ]{2,}/g,' ').split(' ');
            for (var i = 0, ci; ci = attrNames[i++];) {
                ci = attrFix[ci] || ci;
                switch (ci) {
                    case 'className':
                        node[ci] = '';
                        break;
                    case 'style':
                        node.style.cssText = '';
                        //if(node.getAttributeNode('style') != null){ //加上这句
                //3048            !browser.ie && node.removeAttributeNode(node.getAttributeNode('style'))
                        //}
                }
                node.removeAttribute(ci);
            }
        },
    

       导致错误的原因就是3048行 node.getAttributeNode('style') 返回null,然后传入了 removeAttributeNode 里。解决的方法是加入node.getAttributeNode('style') 为 null 的判断,如上代码所示。

  • 相关阅读:
    十七、S3C2440 音频解码芯片WM8976声卡驱动移植、madplay测试
    2.3 摄像头驱动_vivi驱动程序分析
    3.1 wifi网卡RT3070在S3C2440的移植和使用
    项目简介
    2.2 vivi虚拟视频驱动测试
    2.1 摄像头V4L2驱动框架分析
    LCD驱动程序编写
    LCD驱动程序
    1. Linux内核的配置与裁减:
    第5章 docker run、exec和attach使用和区别
  • 原文地址:https://www.cnblogs.com/woaic/p/3942986.html
Copyright © 2011-2022 走看看