Ueditor style filter removal and remote image upload customization

Source: Internet
Author: User
Tags script tag tagname

Ueditor custom editing, such as the need to do lazy loading, this time need to customize the picture, but, Ueditor will remove the img above the attributes, such as data-original and the remote image upload automatically.

At this time, first, you need to give the image automatic upload plus attributes, as for the Jquery.lazyload delay loading of the picture, must have the data-original attribute, as long as the detection of this property, it is not remotely uploaded. Additional properties Customize the mention of the house, the code is as follows:

' Wordimage ': {

            execCommand:function () {                var images = domUtils.getElementsByTagName(me.body, "img");                var urlList = [];                for (var i = 0, ci; ci = images[i++];) {                    if(ci.getAttribute("data-original")||ci.getAttribute("original")||ci.getAttribute("local")||ci.getAttribute("remote")||ci.getAttribute("qiniu")){                        break;                    }else {                        var url = ci.getAttribute("word_img");                        url && urlList.push(url);                    }                }                return urlList;            },

Second, remove, for script filter, for script tag, add specific ID alive class, do not let ueditor processing.

                case ‘style‘:                case ‘script‘:                    if(node.id===‘andyZhou‘||node.className==="andyZhou"){                        break;                    }else {                        node.setAttr({                            cdata_tag: node.tagName,                            cdata_data: (node.innerHTML() || ‘‘),                            ‘_ue_custom_node_‘:‘true‘                        });                        node.tagName = ‘div‘;                        node.innerHTML(‘‘);                        break;                    }                    break;

Third, add the script and style tags to the whitelist.

        script:[‘src‘,‘defer‘,‘async‘,‘charset‘],        source:[‘src‘],        style:[],

At this point, you can customize your edits in HTML mode and enjoy the benefits of Ueditor.

This is DIY casually pondering, if there is a better mode, please advise, more.

Reprint Please specify source: Ueditor style filter removal and remote image upload customization-phpcms tutorial-Zhou Lujun's personal website please add link description

Ueditor style filter removal and remote image upload customization

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.