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

    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;

  • 相关阅读:
    主流负载均衡器LVS、Nginx、HAProxy介绍
    shell脚本加密软件shc
    Linux系统安全配置相关
    Linux系统split对tar文件进行分片和压缩
    kubernetes组件详解和创建POD流程
    构建RPM之SPEC详解
    Python推荐系统框架:RecQ
    Python常用库-Psutil
    使用NLP从文章中自动提取关键字
    模糊字符串匹配:FuzzyWuzzy
  • 原文地址:https://www.cnblogs.com/noviceliu/p/2247995.html
Copyright © 2011-2022 走看看