EasyUI集成Kindeditor使用

在实际的项目中,我们需要在项目中集成富文本编辑器,而kindeditor作为一款优良的编辑器,在项目中或多或少都会用到!

实际效果图
 
 

使用方法:

1.首先下载Kindeditor编辑器,我这里使用的是4.1.10版本。下载地址:http://kindeditor.net/down.php

2.在所需页面上引入Kindeditor相关js文件(注意引入路径):

<!--引入引入kindeditor编辑器相关文件-->
<link rel="stylesheet" href="Kindeditor4.1.10/themes/default/default.css" />
<script charset="utf-8" src="Kindeditor4.1.10/kindeditor.js"></script>
<script charset="utf-8" src="Kindeditor4.1.10/lang/zh_CN.js"></script>

3.在所需页面上需要一个<textarea></textarea>,(注意ID号唯一)如下所示:

 <textarea id="content" name="content"  style="700px; height:300px;"></textarea>

4.在页面创建Kindeditor(参数自己可以根据实际项目选配):

<script type="text/javascript">
 $(function(){
    var editor;
    window.editor = KindEditor.create('#content',{
              resizeType:1,      
              urlType:'domain', // 带有域名的绝对路径
 });
 });
</script>

不能使用以下方式,使用以下方式会导致在谷歌、火狐等浏览器下无法正常显示编辑器。因为KindEditor.ready无法正常执行。

<script>
 var editor;
 KindEditor.ready(function(K){
    window.editor = K.create('#content',{

         resizeType:1, 
         urlType:'domain', // 带有域名的绝对路径
    });
});
</script>

原文地址:https://www.cnblogs.com/itsharehome/p/4719958.html