Baidu Ueditor Editor's HTML mode auto-replace style workaround

Source: Internet
Author: User

Baidu's Ueditor editor for security reasons, HTML documents that users paste in HTML mode are automatically stripped of style and escaped. Although safe, but very inconvenient.

Make a change to remove this function.

First, open the Ueditor.all.js

Two, about 9300 lines to find the///plugin editor default filter conversion mechanism, the following

[JavaScript]View PlainCopy
    1. ' Allowdivtranstop ':true

The value is changed to False. When True, the div is automatically converted to p.

Three, about 9429 lines, there is a case ' Li ', this is to remove the style Li inside, the case commented out.

Four, about 14058 lines, the following first Utils.each function comment out, this is automatically to Li inside the content to add a p.

Five, about 14220 lines,

[JavaScript]View PlainCopy
    1. Node.classname = Utils.trim (Node.className.replace (/list-paddingleft-\w+/,")) + ' list-paddingleft-' + type;

Comment out, this is automatically add a built-in style to UL.

The following 14222 lines

[JavaScript]View PlainCopy
    1. Li.style.cssText && (Li.style.cssText = ");

Comment out, this is the Li style that automatically removes the pasted code

Six, about 9327 lines and 9471 rows near the

[JavaScript]View PlainCopy
    1. else if (node.tagname = = ' span ' && (!node.attrs | | utils.isemptyobject (NODE.ATTRS))) {
    2. Node.parentNode.removeChild (node, true)
    3. }

Remove, this is the code if there is a similar <span> text </span> This does not include the style of <span> elements will be deleted <span> only the text is preserved.

At this point, we pasted in the HTML format of the UL and Li will not be escaped.

PS: The above version is modified based on the 1.3.6 version. The new version location may have changed or the issue has been resolved.

Baidu Ueditor Editor's HTML mode auto-replace style workaround

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.