zoukankan      html  css  js  c++  java
  • ckeditor 在C#中使用

    l来源: http://www.cnblogs.com/jackcovey/archive/2010/04/19/1715646.html

    1.将ckeditor和ckfinder文件夹拷入项目文件夹中,刷新项目。

    2. 在添加编辑控件的页面(aspx)的head中加入

      <script src="ckeditor/ckeditor.js" type="text/javascript"></script>
        <script type="text/javascript" src="ckfinder/ckfinder.js"></script>

    3.插入代码:

        <asp:TextBox ID="i_content" runat="server" TextMode="MultiLine" Height="362px" 
                    Width="100%"></asp:TextBox>
        </div>

    <script type="text/javascript">
            CKEDITOR.replace('<%= i_content.ClientID %>', {skin : 'kama'}); 
    </script>

    4.在项目文件夹中加入uploads文件夹

    5.把文件夹中的bin目录下的dll文件添加到网站的引用中,防止出现找不到类的错误。(未能加载类型“CKFinder.Connector.Connector”。)

    6.修改页面的page指令ValidateRequest="false" 
    <%@ Page Language="C#" ValidateRequest="false" %>

    7.获取或设置编辑器中的内容 
    //获取编辑器中的内容 
    lblView.Text=Server.HtmlEncode( this.i_content.Text); 
    //设置编辑器中的内容 
    //txtContent.Text = Server.HtmlDecode("<h1>设置内容</h1>"); 
    一些用应中(如ajax应用)需要在客户端处理完所有的数据,然后用它自己的方式向服务器发送数据,在这些情况下,使用CKEditor API就足以轻松获取编辑器实例中的内容。例 如: <script type="text/javascript">
    var editor_data = CKEDITOR.instances.i_content.getData();
    </script>

    8.加入中文字体:

     

    打开CKeditor目录里的config.js,在

    CKEDITOR.editorConfig = function( config )
    {
    };
    里添加如下代码:

    config.font_names='宋体/宋体;黑体/黑体;仿宋/仿宋_GB2312;楷体/楷体_GB2312;隶书/隶书;幼圆/幼圆;微软雅黑/微软雅黑;'+ config.font_names;

     

  • 相关阅读:
    手动实现 SpringMVC
    2014年9月9日 高级命令command的使用(上)
    2014年8月29日 透视图补充及视图开头
    2014年8月24日 菜单 工具条 右键菜单(上下文菜单)
    2014年8月14日 透视图
    2014年8月8日
    2014年8月1日
    关于EMF中从schema到ecore转变中的默认处理问题
    JAVA一些常用的时间操作
    echarts基本使用
  • 原文地址:https://www.cnblogs.com/y0umer/p/3839116.html
Copyright © 2011-2022 走看看