我的博客

解决ckeditor高度无法自适应的问题

function ReloadEditor()
{
    var oCKeditor=CKEDITOR.replace('txtcontent'),{toolbar:'Full'});  //实例化editor
     oCKeditor.on('instanceReady',function(event))                   //准备
    {
       var editor=event.editor;
       setTimeout(function(){     //延时加载
               if(!editor.element)
               {
                    setTimeout(arguments.callee,1);
                    return;
               }
               event.removeListener('instanceReady',this.callee);
               if(editor.name=='txtcontent')
               {
                    editor.resize(editor.container.getStyle('width'),CKEDITOR.document.getById('cke_'+'txtcontent').getParent().$.offsetHeight);         //重载高度计算高度
                }
            },0);
    },null,null,9999);
}


  

 //设置ckeditor只读

CKEDITOR.config.readOnly=true;

 

 

 

posted @ 2013-06-25 16:06  Mr.Ren 嘚、|遊 樂 場  阅读(4360)  评论(2编辑  收藏  举报