Kindeditor Online text Editor how to filter Html_javascript tips

Source: Internet
Author: User
Tags tag name

Kindeditor is an open source HTML visual editor, mainly used for users to get WYSIWYG editing on the site, compatible with IE, Firefox, Chrome, Safari, opera and other mainstream browsers. Kindeditor is written using JavaScript and can seamlessly interface with programs such as Java,. NET, PHP, ASP, and so on. 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

In the case of using the Kindeditor text editor, the customer pastes the text directly from Excel into the text editor (can be lazy), and then saves the pasted content directly (you dare not be lazy any more)! For this very silent behavior, I can only yell at him, I do a label filter it, so you paste will not have problems (counselling?) Who provoked the client).

The filtration method is also simple:

Kindeditor.ready (function (K) {
editor = k.create (' textarea[name= ' content '] ', {
filtermode:true,//whether filtering mode is turned on
});

The default filtermode is off state, first set FilterMode to True, and then add Htmltags to specify the HTML tags and attributes to keep. The key of the hash array is the HTML tag name, the value is an array of HTML attributes, "." The starting property represents the Style property. Data type: Object

Kindeditor.ready (function (K) {editor = k.create (' textarea[name= ' content '] ', {filtermode:true,//whether to open filter 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 ', ' quality ', '. 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,de
L ': [' id ', ' class '], iframe: [' id ', ' class ', ' src ', ' frameborder ', ' width ', ' height ', '. Width ', '. Height ']}}; });

The above is a small series to introduce you to the Kindeditor online text editor how to filter HTML, I hope to help!

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.