Thinkphp integrated kindeditor editor details

Source: Internet
Author: User

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.

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.