How does the Kindeditor online text editor filter HTML,

Source: Internet
Author: User

How does the Kindeditor online text editor filter HTML,

KindEditor is an open-source HTML visual editor that allows users to obtain what they see and what they get on their websites. It is compatible with mainstream browsers such as IE, Firefox, Chrome, Safari, and Opera. KindEditor is written in JavaScript and can be seamlessly integrated with Java,. NET, PHP, ASP, and other programs. This is an introduction on the official website.

Home: http://www.kindsoft.net/index.php

Download: http://www.kindsoft.net/down.php

Example: http://www.kindsoft.net/demo.php

If you encounter problems when using the kindeditor text editor, you can directly paste the text content from the Excel file to the text editor (can you be lazy ), save it without adjusting the paste content (you dare not be too lazy )! For this kind of speechless behavior, I can only yell at him, I will make a tag filter, so that you can paste it without any problems? ).

The filtering method is also simple:

KindEditor. ready (function (K) {editor = K. create ('textarea [name = "content"] ', {filterMode: true, // whether filtering mode is enabled });});

FilterMode is disabled by default. First, set filterMode to true, and then add htmlTags to specify the HTML Tag and attributes to be retained. The key of the hash array is the HTML Tag name, the value is the HTML attribute array, and the attribute starting with "." indicates the style attribute. Data Type: Object

KindEditor. ready (function (K) {editor = K. create ('textarea [name = "content"] ', {filterMode: true, // whether to enable the filtering mode htmlTags: {font: ['id', 'class ', 'color', 'SIZE', 'face ','. background-color'], div: ['id', 'class', 'align ','. border ','. margin ','. padding ','. text-align ','. color ','. background-color ','. font-size ','. font-family ','. font-weight ','. background ','. font-style ','. text-decoration ','. vertical-align ','. margin-left '], a: ['id', 'class', 'href', 'target', 'name'], embed: ['id ', 'class', 'src', 'width', 'height', 'type', 'loop ', 'autostart', 'qc ','. width ','. height ', 'align', 'allowScriptAccess'], img: ['id', 'class', 'src', 'width', 'height', 'border ', 'alt', 'title', 'align ','. width ','. height ','. border '], 'P, ol, ul, li, blockquote, h1, h2, h3, h4, h5, h6': ['id', 'class ', 'align ','. text-align ','. color ','. background-color ','. font-size ','. font-family ','. background ','. font-weight ','. font-style ','. text-decoration ','. vertical-align ','. text-indent ','. margin-left '], pre: ['id', 'class'], hr: ['id', 'class ','. page-break-after '], 'br, tbody, tr, strong, B, sub, sup, em, I, u, strike, s, del ': ['id', 'class'], iframe: ['id', 'class', 'src', 'frameborder', 'width', 'height ','. width ','. height '] }});});

The above section describes how to filter HTML in the Kindeditor online text editor. I hope it will help you!

Articles you may be interested in:
  • Procedure for ASP. NET Website to use the Kindeditor Rich Text Editor

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.