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