富文本编辑器
富文本编辑器,Rich TextEditor, 简称 RTE, 它提供类似于 MicrosoftWord 的编辑功能。常 用的富文本编辑器
KindEditor http://kindeditor.net/
UEditor http://ueditor.baidu.com/website/
CKEditor http://ckeditor.com/
引入富文本编辑器
<link rel="stylesheet" href="../plugins/kindeditor/themes/default/default.css" />
<script charset="utf-8" src="../plugins/kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="../plugins/kindeditor/lang/zh_CN.js"></script>
初始化 kindeditor 编辑器
<script type="text/javascript">
var editor;
KindEditor.ready(function(K) {
editor = K.create('textarea[name="content"]', {
allowFileManager : true
});
});
</script>
获取在controller.js 中获取文本编辑器内容
$scope.entity.goodsDesc.introduction=editor.html();
清空文本编辑器
function(response){
if(response.success){
alert("保存成功");
$scope.entity={};
editor.html('');//清空富文本编辑器
}else{
alert(response.message);
}
}
引用编辑器
<textarea name="content" style="width:800px;height:400px;visibility:hidden;" ></textarea>