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");
});html