FCKeditor是一种在线编辑器,功能强大又方面(做广告了,呵呵),可惜相关资料不多,有的也只是英文的,这里就把我在使用过程中一点心得帖出来,希望对大家有所帮助.
首先需要下载:
FCKeditor_2.4;
FCKeditor.Net_2.2
下载地址:http://www.fckeditor.net/download
注意:在.net中使用必须下载这两样
接下来是安装与配置:
1、下载后解压缩,把FCKeditor_2.4/fckeditor文件夹放到iis下或是其他WEB可以看到的地方
2.、再把FCKeditor.Net_2.2下的FredCK.FCKeditorV2.dll文件放到iis根目录下的bin文件夹中,并在vs中添加该控件,或引用
3、新建一个WEB FORM,如果你是把该控件添加到vs中,则只要把控件拖上去就行,设置基本路径BasePath,如果是在项目中引用的话,则自己写html了,最终的样子如下:
<%@ Page language="c#" Codebehind="CreateWordEdit.aspx.cs" AutoEventWireup="false" Inherits="WordApplication.CreateWordEdit" ValidateRequest="false" %>
<%@ Register TagPrefix="fckeditorv2" Namespace="FredCK.FCKeditorV2" Assembly="FredCK.FCKeditorV2" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>CreateWordEdit</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<FCKEDITORV2:FCKEDITOR id="FCKeditor1" runat="server" BasePath="FCKeditor/"></FCKEDITORV2:FCKEDITOR><br>
<input id="Submit1" type="submit" value="Submit" name="Submit1" runat="server">
<asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 80px; POSITION: absolute; TOP: 216px" runat="server"
Text="Button"></asp:Button>
<asp:Button id="Button2" style="Z-INDEX: 102; LEFT: 200px; POSITION: absolute; TOP: 224px" runat="server"
Text="Word"></asp:Button></form>
</body>
</HTML>
里面的BasePath就是FCKeditor_2.4/fckeditor文件夹所在的相对路径<%@ Register TagPrefix="fckeditorv2" Namespace="FredCK.FCKeditorV2" Assembly="FredCK.FCKeditorV2" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>CreateWordEdit</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<FCKEDITORV2:FCKEDITOR id="FCKeditor1" runat="server" BasePath="FCKeditor/"></FCKEDITORV2:FCKEDITOR><br>
<input id="Submit1" type="submit" value="Submit" name="Submit1" runat="server">
<asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 80px; POSITION: absolute; TOP: 216px" runat="server"
Text="Button"></asp:Button>
<asp:Button id="Button2" style="Z-INDEX: 102; LEFT: 200px; POSITION: absolute; TOP: 224px" runat="server"
Text="Word"></asp:Button></form>
</body>
</HTML>
4、在FCKeditor_2.4/fckeditor下找到fckconfig.js修改 _FileBrowserLanguage和_QuickUploadLanguage的定义为aspx
到这里安装与简单的配置就结束了,调试运行你就可以看到效果了,样子灰灰的,不怎么好看,下面就介绍下怎么修改样式以及其他相关的
1、修改样式:
在FCKeditor_2.4/fckeditor下找到fckconfig.js修改FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/office2003/' ;这样看上去就好多了。
2、隐藏工具:
在FCKeditor_2.4/fckeditor下找到fckconfig.js修改FCKConfig.ToolbarSets["Default"]就可以了
3、修改换行时空出的距离太大(行距)
在FCKeditor_2.4/fckeditor下找到fckconfig.js修改FCKConfig.EnterMode为'div'就可以了
4、上传是出错:
The Server didn't Send back a proper XML response
需要看具体问题而定,就我的问题是:我直接使用了他的源代码,而不是引用dll,并且把命名空间改了,所以找不到后台的代码(Could not load 'FredCK.FCKeditorV2.FileBrowserConnector').
最后给出一个介绍的比较详细的网站:http://wiki.fckeditor.net/FCKeditor