当前位置:K88软件开发文章中心编程全书编程全书01 → 文章内容

如何精简ckeditor

减小字体 增大字体 作者:佚名  来源:翔宇亭IT乐园  发布时间:2019-1-3 1:39:34

:2010-12-07 08:25:58

    在部署到Web服务器上时,下列文件夹和文件都可以删除:

    /_samples :示例文件夹;

    /_source :未压缩源程序;

    /lang文件夹下除 zh-cn.js、en.js 以外的文件(也可以根据需要保留其他语言文件);

    根目录下的 changes.html(更新列表),install.html(安装指向),license.html(使用许可);

    /skins 目录下不需要的皮肤,一般用V2(简单,朴素) ,如果只保留V2则必须在config.js中指定皮肤。

这些东西是免费的,使用相对fckeditor来说,省了类库fckdetior.dll的引用,直接在页面使用js!。。。。。。。但是这个时候 发现上传功能使用不了!原来fckefitor把他以前的功能整合拆分了,ckeditor、ckfinder,两部分,后者是上传功能要钱的!!再在网 上找找,有破解方法,下了个ckfinder放进工程根目录!!在页面添加了

 <script type="text/javascript">
                       //如果是在ASP.NET环境下用的服务器端控件<TextBox>
                       var editor = CKEDITOR.replace('tbContent');
                       CKFinder.SetupCKEditor(editor, '/ckfinder/');(这个是在ckeditor基础上加的ckfinder)
                       </script>

发现还是不行,上传出来错误页面!接着费了好多周折:

ckfinder/config:

public override bool CheckAuthentication()
 {
  return true;
 }

ckeditror/config.js加入:

CKEDITOR.editorConfig = function( config )
{
 // Define changes to default configuration here. For example:
 // config.language = 'fr';
    // config.uiColor = '#AADC6E';
 config.filebrowserBrowseUrl = location.hash + '../ckfinder/ckfinder.html';
config.filebrowserImageBrowseUrl = location.hash + '../ckfinder/ckfinder.html?Type=Images';
config.filebrowserFlashBrowseUrl = location.hash+'../ckfinder/ckfinder.html?Type=Flash';
config.filebrowserUploadUrl = location.hash + '../ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Files';
config.filebrowserImageUploadUrl = location.hash + '../ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Images';
config.filebrowserFlashUploadUrl = location.hash + '../ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Flash';
// config.filebrowserWindowWidth = '800';
// config.filebrowserWindowHeight = '500';
};

带颜色的部分是容易出错的地方,开始我没有放..(根目录)

      登录后,您就出现在这里。                     一直出错后来加了..在前面表示从工程根目录开始。错误解决!! 最后就是破解了:

下面简单说一下我的破解步骤:(摘自别人)

1、使用FF浏览器中的firebug插件;

2、打开安装好的文件浏览器,发现是调用的ckfinder.html文件;

3、在ckfinder.html中发现<td id ="iO " >这个单元格中写入了一个iframe,src是core/pages/ckffiles.html;

4、继续打开iframe节点在<tr id="he">和<tr id="qu">两个标签之间有一个<tr>没有id,那个叫你给钱的话就在这里面了~;

5、打开 core/pages/ckffiles.html源文件,发现 <tr id="he">和<tr id="qu">之间没有东西,说明这个<tr>是代码生成的;

6、接下来就可以在CKfinder的js里面去找答案了,幸好以前FCKeditor还是比较熟悉,直接到ckfinder\core\js文件夹下面找;

7、这个文件夹下面两个js一个是给IE用的,另一个是给其他浏览器的,这个和FCKeditor一样;

8、打开ckfinder_gecko.js搜索"qu",很快就发现了eF=B.getElementById('qu');这句;

9、再往后面看

if ((1==(dK.indexOf(ab.bW.substr(1,1)) % 5)&&window.top[qC+'\143\141\x74\x69\157\x6E'][qF+'\163\x74'].toLowerCase().replace(s4,"")!=ab.eo.replace(s4,""))||ab.bW.substr(3,1)!=dK.substr(((dK.indexOf(ab.bW.substr(0,1))+dK.indexOf(ab.bW.substr(2,1)))*9) % (dK.length-1),1)){en.call(window,qo);};eF.appendChild(D);

这段最后的 appendChild~,差不多就在这里了;

10、前面一大堆条件,执行的就只有 en.call(window,qo);,不是它还是什么~;

11、删除 en.call(window,qo);或者\* en.call(window,qo); *\,再刷新看看果然没了~;

12、完了再修改ckfinder_ie.js,一样的。



如何精简ckeditor