ITPub博客

首页 > IT职业 > IT生活 > ExtJs里使用FckEditor

ExtJs里使用FckEditor

IT生活 作者:youyouaq 时间:2021-09-09 09:15:12 0 删除 编辑

Ext.onReady(function() {   

 var fckFormObj = new Ext.FormPanel({   
  labelWidth:75,   
  url:"",   
  title:"EXT/FCKEditor 集成 -- vb2005xu | cdlinux.ys168.com",   
  bodyStyle:"padding:5px 5px 0",   
  defaultType:"form",   
  buttons:[   
   {   
    text:"Save" ,   
    type:'submit',   
    handler: function(){   
     //获取fckeditor内容赋给textarea   
     Ext.get('fckInstance').dom.value = "jjj";//fckobj.GetXHTML(true) + '提交后';     
     Ext.MessageBox.alert('FCK内容',Ext.get('fckInstance').dom.value);   
     if (fckFormObj.form.isValid())   
     {   
      //创建响应测试函数         
      var fckobj_temp = FCKeditorAPI.GetInstance('fckInstance');   
      //fckobj_temp.UpdateLinkedField();//此方法被绑定到submit事件   
         
      fckFormObj.form.doAction('submit',{   
       url:'submit.php',   
       method:'post',   
       waitMsg:'正在提交,请稍等图片描述',   
        success:function(form,action){//成功   
         showInfo('Success',fckobj_temp.GetXHTML(true));   
        } ,   
        failure:function(form,action){//失败   
         showInfo('Failed','网络中断造成连接失败');   
        }   
      });   
     }   
    }   
   },   
   {   
    text:"Cancel"  
   }   
  ],   
  items:[{   
      xtype:"textarea",   
      fieldLabel:"编辑",   
      labelSeparator:":",   
      id:"fckInstance", //div节点,这里要挂接FCKeditor编辑器   
      name:"fckInstance",   
      width:736,   
      height:371  
  }]   
 });   
 fckFormObj.render(document.body);   
    
   
 //在页面上要求挂载fckeditor/fckeditor.js文件   
 var fckobj = new FCKeditor('fckInstance',810,350);   
 fckobj.BasePath = "/ucren/fckeditor/" ;   
 fckobj.ToolbarSet = 'Default' ;   
 fckobj.ReplaceTextarea();    
    
 //创建响应测试函数   
 function msgBox()   
 {   
  var fckobj_temp = FCKeditorAPI.GetInstance('fckInstance');   
  fckobj_temp.UpdateLinkedField();//此方法被绑定到submit事件   
  Ext.MessageBox.alert('FCK内容',fckobj_temp.GetXHTML( true ));   
     
 }   
    
 function showInfo(tip,str){   
  var win = new Ext.Window({   
   title: '信息提交应答提示 -- ' + tip,   
   width: 400 , height: 200 ,autoScroll: true ,   
   html: '

'+ str +'

'       
  });   
  win.show();   
 }   
});  

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/3050/viewspace-2801257/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: C++函数指针详解
请登录后发表评论 登录
全部评论

注册时间:2019-08-13

  • 博文量
    90
  • 访问量
    783