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="width: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>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM