Method
I am using @ version 4.1.2. Now I have updated KindEditor 4.1.4 and it has been released.
Main features of KindEditor
Fast: small size, fast loading
Open Source: open source code, high level, high quality
Underlying layer: built-in custom DOM class library for precise DOM operations
Extension: plug-in-based design. All functions are plug-ins. You can add or remove functions as needed.
Style: It is very easy to modify the editor style. You only need to modify a CSS file.
Compatible: supports most mainstream browsers, such as IE, Firefox, Safari, Chrome, and Opera.
The following describes how to use kindeditor in thinkphp.
Step 1: Download kindeditor editor http://www.kindsoft.net/
Step 2: File Import
The code is as follows: |
Copy code |
<Link rel = "stylesheet" href = "_ PUBLIC _/kindeditor/themes/default/default.css"/> <Link rel = "stylesheet" href = "_ PUBLIC _/kindeditor/plugins/code/prettify.css"/> <Script charset = "UTF-8" src = "_ PUBLIC _/kindeditor. js"> </script> <Script charset = "UTF-8" src = "_ PUBLIC _/kindeditor/lang/zh_CN.js"> </script> |
Step 3: configure parameters
The code is as follows: |
Copy code |
<Script> KindEditor. ready (function (K ){ Var editor1 = K. create ('textarea [name ="Content"] ', { CssPath: '_ PUBLIC _/kindeditor/plugins/code/prettify.css ', UploadJson: '_ PUBLIC _/kindeditor/php/upload_json.php ', FileManagerJson: '_ PUBLIC _/kindeditor/php/file_manager_json.php ', AllowFileManager: true, AfterCreate: function (){ Var self = this; K. ctrl (document, 13, function (){ Self. sync (); K ('form [name = example] ') [0]. submit (); }); K.ctrl(self.edit.doc, 13, function (){ Self. sync (); K ('form [name = example] ') [0]. submit (); }); } }); PrettyPrint (); }); </Script> <Textarea name = "content" style = "width: 700px; height: 200px; visibility: hidden;"> </textarea> |
Content in textarea and the Red content aboveContentCorresponding
Kindeditor html code filtering cannot be saved
This is because the filter mode (filterMode: true) is enabled by default in the editor ). When filterMode is true, the editor automatically filters HTML code based on htmlTags settings, mainly to generate clean code.
If you want to retain all HTML and modify kindeditor. js, set filterMode to false. To retain specific HTML, set filterMode to true and configure the htmlTags attribute.