FCKEditor目前的最新版本是2.6,但支持.NET的DLL版本還是2.5,本文介紹FCKEditor2.6在ASP.NET中的配置方法。
本文的示例下載地址(包含了整個(gè)解決方案及網(wǎng)站,下載后即可使用):
地址:http://www.china-aspx.com/Forum/showtopic-57.aspx
FCKEditor官方下載地址:http://www.fckeditor.net/download
配置方法如下:
一、在官方網(wǎng)站上下載
下載地址:http://sourceforge.net/project/downloading.php?group_id=75348&filename=FCKeditor_2.6.zip
解壓后目錄結(jié)構(gòu)如下圖所示:
二、刪除不必要的文件
從官方下載下來(lái)的FCKEditor2.6大小有3.61M(解壓后),其實(shí)有很多文件對(duì)于只用ASP.NET的來(lái)講是不需要的,我們可以刪除不必要的文件:
1.根目錄下除editor目錄、fckconfig.js、fckeditor.js fckstyles.xml fcktemplates.xml 這幾個(gè)保留,其余的全部刪除
2.editor\filemanager\connectors目錄中除aspx目錄外全部刪除
3.editor\lang目錄中除en.js、zh.js 、zh-cn.js外全部刪除
4.刪除_samples目錄,當(dāng)然如果你想看示例,就不要?jiǎng)h除這個(gè)目錄了。
三、FCKEditor2.6的詳細(xì)設(shè)置
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.
] ;
//上面一段我去掉了一些不常用的功能,可以根據(jù)實(shí)際需要增加。
FCKConfig.DefaultLanguage = 'zh-cn' ; //原來(lái)是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; //原來(lái)這里是 false;不過(guò)還是建議看看上面的警告
}
在SetConfig方法中設(shè)置
UserFilesPath = "~/Upload/FCKEditor";//我這里設(shè)置在了網(wǎng)站根目錄下的Upload/FCKEditor目錄中,根據(jù)實(shí)際情況和個(gè)人喜好而定。
好了,大家有什么問(wèn)題可以去http://www.china-aspx.com/Forum提問(wèn),也可MSN:china-aspx@hotmail.com。
本文的示例下載地址(包含了整個(gè)解決方案及網(wǎng)站,下載后即可使用):
地址:http://www.china-aspx.com/Forum/showtopic-57.aspx
Tag標(biāo)簽: FCKEditor2.6,ASP.NET