FckEditor网页编辑器的使用总结


FCKeditor的官方网站是:http://www.fckeditor.net/download
目前最新的FCKeditor 2.6.3版本。
请在此页下载:
http://sourceforge.net/project/showfiles.php?group_id=75348

要下载Fckeditor 和FckEditor.Net两个压缩文件.

1. 解压FCKeditor.Net_2.6.3.zip找到bin/Debug/2.0下的FredCK.FCKeditorV2.dll,加入到你项目中的bin中.
2.解压FCKeditor_2.6.3.zip,把整个fckeditor加入到项目中的根目录下
3,在程序目录下新建一个文件夹用来保存上传的文件


1,精简 fckeditor 文件
A, 将_开头的文件和文件夹全部删掉
B, 将 fckeditor\editor\lang 语言删掉,保留一个
C, 将 fckeditor\editor\skins 皮肤删掉,保留一个
D, 将 editor\filemanager\connectors 编程语言删掉,保留一个


添加引用 FredCK.FCKeditorV2.dll 到程序和工具箱


点击FCKeditor,选择属性,将 BasePath 改为 /程序名/fckeditor/ ,这样在线编辑器就出来了


修改Fckconfig.js ,以下几项必须修改

FCKConfig.DefaultLanguage = 'zh-cn' ;
var _FileBrowserLanguage = 'aspx' ; // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage = 'aspx' ; // asp | aspx | cfm | lasso | perl | php | py


1,基本的文字输入搞定之后,接下来就是上传,点击图片按钮,报错
A,Fckeditor 默认是不能上传的,修改 \fckeditor\editor\filemanager\connectors\aspx config.ascx,

return true;
B,修改配置文件,将上传的路径 指向你要上传的文件的名字 <add key="FCKeditor:UserFilesPath" value="/

程序名/保存文件的文件夹/" />
C,解决中文乱码问题 fckeditor\editor\filemanager\browser\default  frmupload.html 以UTF-8格式重新保


整个FCKeditor 就设置好了,接下来(选项)
A, 继续删文件
1,\fckeditor 保留 editor,fckconfig.js,fckeditor.js,fckstyles.xml,fcktemplates.xml,

license.txt

B,修改 Fckconfig.js,突出个性在线编辑器
1,修改在线编辑器的宽度和高度,在属性里面
2,FCKConfig.TabSpaces  = 1 ; 允许TAB
3, FCKConfig.ToolbarCanCollapse = false ; 可以折叠
4, 自己一个一个对
FCKConfig.ToolbarSets["Default"] = [
['NewPage','Preview','-','Templates'],
['Cut','Copy','Paste','PasteText','PasteWord','-','SpellCheck'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
['Bold','Italic','Underline','-'],
['OrderedList','UnorderedList','-','Outdent','Indent'],
['JustifyLeft','JustifyCenter','JustifyRight'],
['Link','Unlink'],
['Image','Flash','Table','Rule','Smiley'],
['FontName','FontSize'],
['TextColor','BGColor']
// No comma for the last row.
] ;
5,FCKConfig.FontNames  = '宋体;楷体_GB2312;黑体;隶书;Arial;Times New Roman' ;

C, 修改 源文件,CSS 达到你想要的效果,例如换行


精简fckeditor
  正因为这个编辑器是支持多语言的,所以首先我们针对使用对其做相应的冗余文件删除。
  
  1、临时文件及文件夹删除:从根目录下开始删除一切以“_”开头的文件及文件夹,因为他们为临时文件和

文件夹。删除这类临时文件及文件夹之后,我们还要删除一些根目录下的多余文件,根目录下我们只保留

fckconfig.js(配置文件)、fckeditor.js(js方式调用文件)、fckeditor.php(php方式调用文件,新版本通

过该文件统一调用php4或者php5的调用文件,fckeditor_php4.php/fckeditor_php5.php你可以根据自己服务器

使用的情况删减,建议都保留)、fckeditor_php4.php(php4的调用文件)、fckeditor_php5.php(php5的调用

文件)、fckstyles.xml(样式)、fcktemplates.xml(模板)文件和editor文件夹。
  
  2、editor\lang目录:存放的是多语言配置文件,因为我们只可能用到en和zh-cn(简体中文)所以,根据

我的选择,我删掉其他的语言配置文件。

  3、editor\skins界面目录:默认带有三个界面(default:默认界面,加载速度相对较快;office2003:相

对pp的界面,不过速度确实要慢些;silver:银白色界面,加载速度也相对较快),可以自行决定是否删除其中

一两个。

  4、editor\filemanager\browser\default\connectors目录:存放编辑器所支持的Web动态语言,我们以php

为例所以保留php目录,test.html文件可以帮助你查看某语言下的上传设置等(具体上传设置我将在后面的配置

作较为详细讲解),可以自行决定是否删除。

  5、editor\filemanager\upload目录:同理。

可能出现的错误:
FCKeditor出现"this connector is disabled Please check
the"editor/filemanager/connectors/aspx/config.aspx"错误的解决办法

解决办法:

打开editor/filemanager/connectors/aspx/config.ascx修改CheckAuthentication()方法,返回true

C# code

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;
}
上面的第六步中提到过.

原文地址:https://www.cnblogs.com/wenming205/p/1281401.html