黑夜的狼

沮丧吗,那就是一种无病呻吟!留恋它就是一种高度近视!目光应该放得更远一点! 别不想飞,只是要一步跨过太平洋!

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

c#方式

要添加CKEditor 和CKFinder两个DLL的引用

       CKFinder.FileBrowser _FileBrowser = new CKFinder.FileBrowser();
_FileBrowser.BasePath = "/ckfinder/";
_FileBrowser.SetupCKEditor(CKEditor1);


JS方式

要添加<script src="/ckfinder/ckfinder.js" type="text/javascript"></script>JS引用

       var editor = CKEDITOR.replace('CKEditor1');
CKFinder.setupCKEditor(editor, '/ckfinder/');

整合后,上传时报没有权限这是在 ckfinder/config.ascx 文件的CheckAuthentication方法中 return false造成的

如果无需任何验证都可以上传文件,直接return true或者加入一些条件。

 

在整合后出现"浏览服务器按钮"

如果不需要,可以在ckfinder/ckfinder.js 中找到 f.config.filebrowserFlashUploadUrl

在该属性赋值后加入代码

 f.config.filebrowserBrowseUrl = undefined;
 f.config.filebrowserImageBrowseUrl = undefined;
 f.config.filebrowserUploadUrl = undefined;

其实这三个属性都是CKEditor.config下的属性,只要设为undefined就可以了

注:如果使用C#方式对CKEditor和 CKFinder进行整合,设置这三个属性无效,必须使用JS方式整合

 

或者在使用C#方式整合时,加上这三条代码

 

CKFinder.FileBrowser _FileBrowser = new CKFinder.FileBrowser();
_FileBrowser.BasePath = "/ckfinder/";
_FileBrowser.SetupCKEditor(CKEditor1);
CKEditor1.config.toolbar = new object[]
{
new object[] { "Bold", "Italic", "-", "NumberedList", "BulletedList", "-", "Link", "Unlink" },
new object[] { "Cut", "Copy", "Paste", "PasteText", "PasteFromWord", "-", "Print", "SpellChecker", "Scayt","-","Image" },
};
CKEditor1.config.filebrowserBrowseUrl = "";
CKEditor1.config.filebrowserImageBrowseUrl = "";
CKEditor1.config.filebrowserUploadUrl = "";


 

 

官方说明:

 
CKEDITOR.config.filebrowserBrowseUrl
The location of an external file browser that should be launched when the Browse Server button is pressed.
<static>  
The location of an external file browser that should be launched when the Browse Server button is pressed in the Flash dialog window.
<static>  
The location of the script that handles file uploads in the Flash dialog window.
<static>  
The location of an external file browser that should be launched when the Browse Server button is pressed in the Link tab of the Image dialog window.
<static>  
The location of an external file browser that should be launched when the Browse Server button is pressed in the Image dialog window.
<static>  
The location of the script that handles file uploads in the Image dialog window.
<static>  
CKEDITOR.config.filebrowserUploadUrl
The location of the script that handles file uploads.
posted on 2011-11-11 01:15  anncesky  阅读(484)  评论(0)    收藏  举报