通常我们写大段文字需要用到textarea标签,但是它仅仅能实现纯文字编辑,当我们需要上传的内容有文本和图片或者视频表情时,这个时候需要用到富文本插件来帮我们实现,下面开始介绍KindEditor的实现方法。
1、
下载 KindEditor 最新版本
下载页面: http://www.kindsoft.net/down.php
2、解压文件后,随便创建index.html文件,在index.html中引入
<
link
rel=
"stylesheet"
href=
"themes/default/default.css">
<
script
src=
"kindeditor-all-min.js"></
script>
<
script
src=
"lang/zh-CN.js"></
script>
3、
KindEditor.
ready(
function (
K) {
window.editor
= K.
create(
'#editor_id',{
themeType :
'simple',
allowFileManager:
true,
uploadJson :
'../images/',
//要存放图片等文件的后台接口,
fileManagerJson :
'../manager/images/',
afterBlur:
function(){
this.
sync();}
});
html
= document.
getElementById(
'editor_id').value;
window.editor.
html($scope.video.describe);
});
4、页面中显示如下