在線編輯器的使用總結(kindeditor , )


1)、kindedtor中讓編輯框默認為“HTML代碼/源代碼”模式

[javascript]   view plain copy print ?
  1. <script>  
  2.         // 自定義插件 #1  
  3.         KindEditor.lang({  
  4.             example1 : '插入HTML'  
  5.         });  
  6.            
  7.         // 自定義插件 #2  
  8.         KindEditor.lang({  
  9.             example2 : 'CLASS樣式'  
  10.         });  
  11.            
  12.         KindEditor.ready(function(K) {  
  13.             KindEditor.options.designMode = false;//添加的內容  
  14.             K.create('#content', {  
  15.                 cssPath : ['plugins/code/prettify.css''index.css'],  
  16.                 items : ['source''removeformat''code']  
  17.             });   
  18.         });  
  19.     </script>   

如上所示:在K.create('#content', { 前添加 KindEditor.options.designMode = false; 設置成false即為打開是默認為源代碼模式。

 

 2)、Javascript無法獲取kindedtor中textarea里的值。

在創建的時候加上:afterBlur 屬性:afterBlur: function(){this.sync();}

如下:

[javascript]   view plain copy print ?
  1. KindEditor.ready(function(K) {  
  2.                 KindEditor.options.designMode = false;  
  3.                     editor=K.create('#content', {  
  4.                     cssPath : ['plugins/code/prettify.css''index.css'],  
  5.                     items : ['source''removeformat''code'],  
  6.                     afterBlur: function(){this.sync();}  
  7.                 });    
  8.             });  

 

 3)、修改kindedtor中textarea里的值,重新設置kindedtor中textarea里的值。

[javascript]   view plain copy print ?
  1. var <span style="color:#cc0000;">editor</span>;  
  2.             KindEditor.ready(function(K) {  
  3.                 KindEditor.options.designMode = false;  
  4.                     editor=K.create('#content', {  
  5.                     cssPath : ['plugins/code/prettify.css''index.css'],  
  6.                     items : ['source''removeformat''code'],  
  7.                     afterBlur: function(){this.sync();}  
  8.                 });    
  9.             });  

editor.html("更改后的內容");


免責聲明!

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



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