FCKeditor.net使用教程

FCKeditor.net使用教程

下载
FCKeditor.net 分为两部分:静态部分与组件本分。
  下载最新页面
  http://www.fckeditor.net/download
  下载源码
  http://sourceforge.net/project/showfiles.php?group_id=75348&package_id=137125
  解压缩下载包;编译源码,并生成组件。

安装配置
  1、拷贝 "FredCK.FCKeditorV2.dll" 到BIN目录。拷贝fckeditor文件夹到站点跟目录;
  2、用文本编辑器打开fckeditor/fckconfig.js文件,开始对编辑器进行配置;
  var _FileBrowserLanguage = 'asp' ; 
  var _QuickUploadLanguage = 'asp' ; 
  改为
  var _FileBrowserLanguage = 'aspx' ; 
  var _QuickUploadLanguage = 'aspx' ; 
  3、配置webConfig选项;
  <appSettings>
  <add key="FCKeditor:BasePath" value="/EDItTest/fckeditor/"/>
  <add key="FCKeditor:UserFilesPath" value="/EDItTest/Files/" />
  </appSettings>
  4、在页面中使用控件
  添加页面指令:<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
  添加一个控件:<FCKeditorV2:FCKeditor ID="FCKeditor2" runat="server"></FCKeditorV2:FCKeditor>

使用示例
  自定义按钮
  1、用文本编辑器打开fckeditor/fckconfig.js文件
  2、拷贝FCKConfig.ToolbarSets["Basic"] = [['Bold','Italic','-','OrderedList','UnorderedList','-','Link','Unlink','-','About']] ; 
  改为:
  FCKConfig.ToolbarSets["Myself"] = [['Bold','Italic','-','OrderedList','UnorderedList']] ; 
  3、设置控件的ToolbarSet属性。<FCKeditorV2:FCKeditor ID="FCKeditor2" ToolbarSet="Myself" runat="server"></FCKeditorV2:FCKeditor>
  设置语言
  FCKeditor2.AutoDetectLanguage=false; //是否自动检测语言。根据用户浏览器的语言设置来显示浏览器的的语言。
  FCKeditor2.DefaultLanguage = "en"; //设置输出的语言。
  使用JS API
  待完善
  上传图片选项。
  FCKConfig.ImageDlgHideLink= false ;
  FCKConfig.ImageDlgHideAdvanced = true ;
  FCKConfig.ImageUpload = false ;
  FCKConfig.ImageUploadURL = FCKConfig.BasePath + 'filemanager/upload/' + _QuickUploadLanguage + '/upload.' + _QuickUploadLanguage + '?Type=Image' ;
  FCKConfig.ImageUploadAllowedExtensions = ".(jpg|gif|jpeg|png|bmp)$" ; // empty for all
  FCKConfig.ImageUploadDeniedExtensions = "" ; // empty for no one
  换肤
  系统提供了三种皮肤:default,office2003,silver; 在控件上设置SkinPath="editor/Skins/Default/";也可以通过程序完成设置
  其它设置
   
  在编辑器域内可以使用Tab键。(1为是,0为否) FCKConfig.TabSpaces = 0 ; 改为FCKConfig.TabSpaces = 1 ;

示例代码
fckeditor.aspx
<%@ Page Language="C#" AutoEventWireup="true" ValidateRequest="false" CodeFile="fckeditor.aspx.cs" Inherits="fckeditor" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
  <title>Untitled Page</title>
</head>
<body>
  <form id="form1" runat="server">
  <div>
  <br />
  全部按钮<br />
<FCKeditorV2:FCKeditor ID="FCKeditor1" runat="server" >
  </FCKeditorV2:FCKeditor>
  <br />
  基本按钮<br />
  <FCKeditorV2:FCKeditor ID="FCKeditor2" ToolbarSet="Basic" runat="server"></FCKeditorV2:FCKeditor>
  <br />
  精简按钮<br />
  <FCKeditorV2:FCKeditor ID="FCKeditor3" ToolbarSet="Basic2" runat="server">
  </FCKeditorV2:FCKeditor>
  <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />&nbsp;
  <br />
  <a href="fckeditor/_samples/default.html">浏览更多示例</a>
  </div>
  </form>
</body>
</html>
fckeditor.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using FredCK.FCKeditorV2;
public partial class fckeditor : System.Web.UI.Page
...{

  protected void Page_Load(object sender, EventArgs e)
  ...{
  FCKeditor1.AutoDetectLanguage=false;
  FCKeditor1.DefaultLanguage = "en";
  FCKeditor1.FillEmptyBlocks = false;
  FCKeditor1.ToolbarCanCollapse = true;
  FCKeditor1.SkinPath = FCKeditor1.BasePath + "editor/Skins/silver/";
  }
  protected void Button1_Click(object sender, EventArgs e)
  ...{
  string html= FCKeditor1.Value ;
  }
}
 



---


要修改上传后对话框e文,请打开editor/dialog/目录下的
fck_flash
fck_image
fck_link
目录下的js,翻译即可



评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值