博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[转]ExtJS3.0与KindEditor4.1.2整合
阅读量:4322 次
发布时间:2019-06-06

本文共 1407 字,大约阅读时间需要 4 分钟。

原文地址:

ExtJS与KindEditor整合的方式。

[javascript]
   
  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]
   
    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.         width:'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. });  

转载于:https://www.cnblogs.com/dirgo/p/7416600.html

你可能感兴趣的文章
引用的意义
查看>>
vue中播放音乐
查看>>
ORA-15260: permission denied on ASM disk group
查看>>
Linux中seq命令的用法
查看>>
HTTP协议的chunked编码
查看>>
画原型是节省人力的最好办法
查看>>
shell(十)排序
查看>>
Operating System-进程间互斥的方案-保证同一时间只有一个进程进入临界区(2)- Peterson解法...
查看>>
1.1 Friday the Thirteenth
查看>>
VS 高亮显示不带后缀的C++头文件
查看>>
python基础之面向对象
查看>>
Abnormal build process termination--解决IDEA启动web项目报错
查看>>
JS设计模式之工厂模式
查看>>
Git忽略规则及.gitignore规则不生效的解决办法
查看>>
EasyUI 搜索框
查看>>
impdp and docker install oracleXE
查看>>
入门训练 序列求和
查看>>
web前端_Vue框架_设置浏览器上方的标题和图标
查看>>
gnome3 隐藏标题栏
查看>>
duilib入门简明教程 -- 第一个程序 Hello World(3) (转)
查看>>