• [转]ExtJS3.0与KindEditor4.1.2整合


    原文地址:http://blog.csdn.net/resigshy/article/details/7937021

    ExtJS与KindEditor整合的方式。

    [javascript] view plain copy print?
    1. /** 
    2.  * 将KindEditor4.1.2 功能封装到命名空间“KE“。 
    3.  * @author shuyuan 
    4.  */  
    5. Ext.namespace("KE");  
    6. KE.app = (function() {  
    7.     return {  
    8.         /** 
    9.          * 初始化editor 
    10.          * @param initParam 初始参数。 
    11.          * @returns 
    12.          */  
    13.         init : function (initParam){      
    14.             setTimeout(function(){  
    15.                 KindEditor.create('#' + initParam.renderTo, initParam);  
    16.             }, ((!initParam.delayTime || initParam.delayTime) <= 0 ? 5 : initParam.delayTime));  
    17.         },  
    18.         /** 
    19.          * 获取创建后的editor对象。 
    20.          * @param renderTO textarea的ID,根据此参数查找已创建的editor对象 
    21.          * @returns 
    22.          */  
    23.         getEditor : function(renderTO) {  
    24.             var editors = KindEditor.instances;  
    25.             for(var i = 0; i < editors.length; i++){  
    26.                 if(editors[i].renderTo && editors[i].renderTo === renderTO){  
    27.                     return editors[i];  
    28.                 }         
    29.             }     
    30.         }  
    31.     };  
    32. })();  


     

    初始化KindEditor:

    [javascript] view plain copy print?
      1. var contentFormPanelCn = new Ext.form.FormPanel({  
      2.     id : 'contentFormPanelCn',  
      3.     title:mpdLang.chinese, //'中文',  
      4.     layout : 'fit',  
      5.     bodyStyle:"border:0px;padding:0px",  
      6.     defaultType : 'textfield',  
      7.     items : [{  
      8.         xtype:'textarea',  
      9.         id:'contentCn',  
      10.         'auto',  
      11.         height:'auto'  
      12.     }],  
      13.     listeners:{  
      14.         'render':function(){  
      15.             KE.app.init({  
      16.                 renderTo : "contentCn",  
      17.                 delayTime : 1,  
      18.                 readonlyMode : false,  
      19.                 resizeType : 0,  
      20.                 width : '100%',  
      21.                 minChangeSize : 20,  
      22.                 imageTabIndex : 1,  
      23.                 uploadJson : ""
      24.                 
      25.             });  
      26.         }             
      27.     },  
      28.     buttons:[{  
      29.         text:commonality_save,//保存  
      30.         id:"btnEditContentCn",  
      31.         handler : function() {  
      32.             var html = KE.app.getEditor('contentCn').html();//取值  
      33.         }  
      34.     }],  
      35.     buttonAlign:'center'  
      36. });  
  • 相关阅读:
    MVC 4 中 WEB API 选择 返回格式
    用XML配置菜单的一种思路,附一些不太准确的测试代码
    2020.11.15(每周总结)
    2020.11.19
    2020.11.22
    2020.11.21
    2020.11.14
    202.11.13
    2020.11.20
    2020.11.17
  • 原文地址:https://www.cnblogs.com/dirgo/p/7416600.html
Copyright © 2020-2023  润新知