FineUI 官方论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

本论坛已关闭(禁止注册、发帖和回复)
请移步 三石和他的朋友们

FineUI首页 WebForms - MVC & Core - JavaScript 常见问题 - QQ群 - 十周年征文活动

FineUI(开源版) 下载源代码 - 下载空项目 - 获取ExtJS - 文档 在线示例 - 版本更新 - 捐赠作者 - 教程

升级到 ASP.NET Core 3.1,快、快、快! 全新ASP.NET Core,比WebForms还简单! 欢迎加入【三石和他的朋友们】(基础版下载)

搜索
查看: 6466|回复: 6
打印 上一主题 下一主题

kindeditor整合的例子

[复制链接]
跳转到指定楼层
楼主
发表于 2014-12-18 13:15:54 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 zy32002 于 2014-12-18 23:54 编辑

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
</head>
<body>
   <form id="form1" runat="server">
        <fageManager runat="server" />
        <f:ContentPanel runat="server" Height="300">


            <asp:TextBox runat="server" ID="Editor" Width="725px" Height="450px" TextMode="MultiLine"
                Style="visibility: hidden;"></asp:TextBox>

         
        </f:ContentPanel>
       <br>
       <f:Button runat="server" ID="btn" Text="取值"/>
    </form>
</body>
</html>
<link href="kindeditor/themes/default/default.css" rel="stylesheet">
<link href="kindeditor/plugins/code/prettify.css" rel="stylesheet">
<script src="kindeditor/kindeditor.js" charset="utf-8"></script>
<script src="kindeditor/lang/zh_CN.js" charset="utf-8"></script>
<script src="kindeditor/plugins/code/prettify.js" charset="utf-8"></script>
<script>


    var editor;
    KindEditor.ready(function (K) {
        editor = K.create('#<%=Editor.ClientID%>', {
            items: ['source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste',
                'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
                'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
                'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
                'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
                'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'multiimage',
                'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak',
                'anchor', 'link', 'unlink'],
            cssPath: 'kindeditor/plugins/code/prettify.css',
            uploadJson: 'kindeditor/asp.net/upload_json.ashx',
            fileManagerJson: 'kindeditor/asp.net/file_manager_json.ashx',
            allowFileManager: true,
        });

        editor.focus();
        prettyPrint();

    });


    function getValue() {
        // 同步数据后可以直接取得textarea的value,FineUI框架 button提交时先调用
        editor.sync();
    }

    //延时重新创建kindeditor(可能是因为extjs组件由于渲染过程比较慢,而kindeditor可能在指定节点创建之前就进行渲染,导致节点未找到等问题)
    F.ready(function () {
        editor.remove().create();
    }).defer(500);
</script>


后台:
protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Editor.Text = "kindeditor整合例子";
            }
        }

        protected void btn_OnClick(object sender, EventArgs e)
        {
            Alert.Show(Editor.Text);
        }




沙发
发表于 2014-12-18 13:22:12 | 只看该作者
本帖最后由 梦如人生 于 2014-12-18 15:58 编辑
  1. <!DOCTYPE html>

  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head runat="server">
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  5.      <title></title>
  6. </head>
  7. <body>
  8.     <form id="form1" runat="server">
  9.          <fageManager runat="server" />
  10.          <f:ContentPanel runat="server" Height="300">


  11.              <asp:TextBox runat="server" ID="Editor" Width="725px" Height="450px" TextMode="MultiLine"
  12.                  Style="visibility: hidden;"></asp:TextBox>

  13.          
  14.          </f:ContentPanel>
  15.         <br>
  16.         <f:Button runat="server" ID="btn" OnClick="btn_OnClick" OnClientClick="getValue()" Text="取值"/>
  17.      </form>
  18. </body>
  19. </html>
  20. <link href="kindeditor/themes/default/default.css" rel="stylesheet">
  21. <link href="kindeditor/plugins/code/prettify.css" rel="stylesheet">
  22. <script src="kindeditor/kindeditor.js" charset="utf-8"></script>
  23. <script src="kindeditor/lang/zh_CN.js" charset="utf-8"></script>
  24. <script src="kindeditor/plugins/code/prettify.js" charset="utf-8"></script>
  25. <script>


  26.      var editor;
  27.      KindEditor.ready(function (K) {
  28.          editor = K.create('#<%=Editor.ClientID%>', {
  29.              items: ['source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste',
  30.                  'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
  31.                  'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
  32.                  'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
  33.                  'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
  34.                  'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'multiimage',
  35.                  'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak',
  36.                  'anchor', 'link', 'unlink'],
  37.              cssPath: 'kindeditor/plugins/code/prettify.css',
  38.              uploadJson: 'kindeditor/asp.net/upload_json.ashx',
  39.              fileManagerJson: 'kindeditor/asp.net/file_manager_json.ashx',
  40.              allowFileManager: true,
  41.          });

  42.          editor.focus();
  43.          prettyPrint();

  44.      });


  45.      function getValue() {
  46.          // 同步数据后可以直接取得textarea的value,FineUI框架 button提交时先调用
  47.         editor.sync();
  48.      }

  49.      //延时重新创建kindeditor(可能是因为extjs组件由于渲染过程比较慢,而kindeditor可能在指定节点创建之前就进行渲染,导致节点未找到等问题)
  50.     F.ready(function () {
  51.          editor.remove().create();
  52.      }).defer(500);
  53. </script>


  54. 后台:
  55. protected void Page_Load(object sender, EventArgs e)
  56.          {
  57.              if (!IsPostBack)
  58.              {
  59.                  Editor.Text = "kindeditor整合例子";
  60.              }
  61.          }

  62.          protected void btn_OnClick(object sender, EventArgs e)
  63.          {
  64.              Alert.Show(Editor.Text);
  65.          }


复制代码
板凳
 楼主| 发表于 2015-1-25 10:00:28 | 只看该作者
根据论坛里的朋友提示,可以把   
F.ready(function () {
         editor.remove().create();
     }).defer(500);

改成
     Ext.onReady(function () {
        editor.remove().create();
    });
达到同样效果
地板
发表于 2015-1-25 11:08:49 | 只看该作者
谢谢此帖. 碰到同样的问题. 得到解决!
6#
 楼主| 发表于 2015-12-1 09:12:24 | 只看该作者
7#
发表于 2015-12-31 11:02:51 | 只看该作者
在使用上传附件时,弹出的对话框无法居中,会显示在按钮的下方。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|FineUI 官方论坛 ( 皖ICP备2021006167号-1 )

GMT+8, 2024-4-20 11:53 , Processed in 0.048045 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表