FCKEditor目前的最新版本是2.6,但支援.NET的DLL版本還是2.5,本文介紹FCKEditor2.6在ASP.NET中的配置方法。
本文的樣本(包含了整個解決方案及網站,下載後即可使用):
地址:http://www.china-aspx.com/Forum/showtopic-57.aspx
FCKEditor官方:http://www.fckeditor.net/download
配置方法如下:
一、在官方網站上下載
:http://sourceforge.net/project/downloading.php?group_id=75348&filename=FCKeditor_2.6.zip
解壓後目錄結構如所示:
二、刪除不必要的檔案
從官方下載下來的FCKEditor2.6大小有3.61M(解壓後),其實有很多檔案對於只用ASP.NET的來講是不需要的,我們可以刪除不必要的檔案:
1.根目錄下除editor目錄、fckconfig.js、fckeditor.js fckstyles.xml fcktemplates.xml 這幾個保留,其餘的全部刪除
2.editor\filemanager\connectors目錄中除aspx目錄外全部刪除
3.editor\lang目錄中除en.js、zh.js 、zh-cn.js外全部刪除
4.刪除_samples目錄,當然如果你想看樣本,就不要刪除這個目錄了。
三、FCKEditor2.6的詳細設定
1.fckconfig.js中修改
FCKConfig.ToolbarSets["Default"] = [
['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
['Link','Unlink','Anchor'],
['Image','Flash','Table','Rule','Smiley','SpecialChar','PageBreak'],
'/',
['Style','FontFormat','FontName','FontSize'],
['TextColor','BGColor'],
['FitWindow','ShowBlocks','-','About'] // No comma for the last row.
] ;
//上面一段我去掉了一些不常用的功能,可以根據實際需要增加。
FCKConfig.DefaultLanguage = 'zh-cn' ; //原來是en
var _FileBrowserLanguage = 'aspx' ; // asp | aspx | cfm | lasso | perl | php | py 改成aspx
var _QuickUploadLanguage = 'aspx' ; // asp | aspx | cfm | lasso | perl | php | py
2.在Bin中加入DLL檔案
DLL檔案:http://sourceforge.net/project/showfiles.php?group_id=75348&package_id=137125
3.在工具列中加入DLL檔案
4.配置上傳路徑
編輯FCKeditor\editor\filemanager\connectors\aspx\config.aspx 中修改
private bool CheckAuthentication()
{
// WARNING : DO NOT simply return "true". By doing so, you are allowing
// "anyone" to upload and list the files in your server. You must implement
// some kind of session validation here. Even something very simple as...
//
// return ( Session[ "IsAuthorized" ] != null && (bool)Session[ "IsAuthorized" ] == true );
//
// ... where Session[ "IsAuthorized" ] is set to "true" as soon as the
// user logs in your system.
return true; //原來這裡是 false;不過還是建議看看上面的警告
}
在SetConfig方法中設定
UserFilesPath = "~/Upload/FCKEditor";//我這裡設定在了網站根目錄下的Upload/FCKEditor目錄中,根據實際情況和個人喜好而定。
好了,大家有什麼問題可以去http://www.china-aspx.com/Forum提問,也可MSN:china-aspx@hotmail.com。
本文的樣本(包含了整個解決方案及網站,下載後即可使用):
地址:http://www.china-aspx.com/Forum/showtopic-57.aspx