kindeditor使用方法

1,首先在html文件中添加一个textarea组件,
<textarea class="form-control" style="width: 100%; height: 150px; margin: 0 auto;" id="content" name="content" rows="10" ng-model="mail.content"></textarea>

2,在js文件中引用该Kindeditor的js文件,定义一个editor,并邦定到html文件中定义的textarea控件,
        var editor=KindEditor.create("textarea[name='content']",{
            allowFileManager:false,
            resizeType:0,
            width:"100%",
            height:"100%",
            uploadJson:"../sendBox/upload",
            afterBlur:function(){
                this.sync();
            }
        });

如果是用在模态对话框中使用kindeditor,需要在显示前重新动态创建一个,才能正常使用:
        $(".newMail").click(function(){
            $scope.mail={};
            $("#editWind").modal("show");

            var editor=KindEditor.create("textarea[name='content']",{
                allowFileManager:false,
                resizeType:0,
                width:"100%",
                height:"100%",
                uploadJson:"../sendBox/upload",
                afterBlur:function(){
                    this.sync();
                }
            });
        });

如果是在模态对话框中使用kindeditor,需要在隐藏的方法中移除该组件邦定的控件,否则下次显示时不能正常使用:
        $(".cancel").click(function(){
            $("#editWind").on("hidden",function(){
                KindEditor.remove("#content");
            });
            $("#editWind").modal("hide");
        });

转载于:https://my.oschina.net/u/1586587/blog/650629

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值