kindeditor-4.1.10文本编辑器多个绑定

如题,就是在同一个页面使用多个kindeditor编辑器

具体实现见下面——

HTML:

...

 

<link rel="stylesheet" href="/Scripts/kindeditor-4.1.10/themes/default/default.css" />
<link rel="stylesheet" href="/Scripts/kindeditor-4.1.10/plugins/code/prettify.css" />
<script charset="utf-8" src="/Scripts/kindeditor-4.1.10/kindeditor-all.js"></script>
<script charset="utf-8" src="/Scripts/kindeditor-4.1.10/lang/zh-CN.js"></script>
<script charset="utf-8" src="/Scripts/kindeditor-4.1.10/plugins/code/prettify.js"></script>

<td style=" padding:10px;">
                                <textarea name="txt_daily_@(platTypeList[i])_@(column.Id)" id="txt_daily_@(platTypeList[i])_@(column.Id)" cols="10" rows="1" style="width:500px;height:28px;"  textareatype="qitashix">@temp.Value</textarea>
                            </td>

...


javascript:

<script type="text/javascript">
    var KindEditorArr = [];
    KindEditor.ready(function (K) {
        var texareaArr = [];
        $('textarea[textareatype=qitashix]').each(function (index, item) {
            texareaArr.push(item);
        });
        for (var i = 0; i < texareaArr.length; i++) {
            var txtarea_id = '#' + texareaArr[i].id; //alert(txtarea_id);
            var editor1 = K.create(txtarea_id, {
                width: "500px",
                height: "28px",
                minWidth: "500px",
                minHeight: "28px",
                cssPath: '/Scripts/kindeditor-4.0.1/plugins/code/prettify.css',
                uploadJson: '/Scripts/kindeditor-4.0.1/asp.net/upload_json.ashx',
                fileManagerJson: '/Scripts/kindeditor-4.0.1/asp.net/file_manager_json.ashx',
                allowFileManager: true,
                items: [
                  'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                  'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
                  'insertunorderedlist', '|', 'emoticons', 'image', 'multiimage', 'link', 'table'],
                afterCreate: function () {
                  var self = this;
//                    K.ctrl(document, 13, function () {
//                        self.sync();
//                        //document.forms['example'].submit();
//                    });
//                    K.ctrl(self.edit.doc, 13, function () {
//                        self.sync();
//                        //document.forms['example'].submit();
//                    });
                    //self.sync(); 
                },
                afterBlur: function () { var self = this; self.sync();  }//alert(self.html());
            }); 
            KindEditorArr.push(editor1);
        }
        prettyPrint();
    });
</script>



转载于:https://my.oschina.net/kongdf/blog/884842

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值