百度ue的富文本编辑器。。有点一言难尽啊。。。
话不多说,直接进入正题
1.首先
富文本编辑器最好直接放在页面上,至于放在啥模态框,右边框。。自己看着办,大概率是不行的
啥导入图片的模态框基本跳不出来,跳出来也在后面,一开始以为是z-index问题,但是我试了,还是不行
2.按照官网下载所需的版本,自己装吧,放入自己项目中。。。注意最好放在外面,不然都是坑
3.百度ue容器
<script id="contentUE" type="text/plain" style="width: 100%;height: 450px" >
</script>
4.导入所需的js
<script type="text/javascript" src="/page/3th/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/page/3th/ueditor/ueditor.all.js"></script>
<!-- 语言包文件(建议手动加载语言包,避免在ie下,因为加载语言失败导致编辑器加载失败) -->
<script type="text/javascript" src="/page/3th/ueditor/lang/zh-cn/zh-cn.js"></script>
记住。上面的三个js的src看好了,导入自己项目的js
5.页面中加入js
<script type="text/javascript">
var ue = UE.getEditor('contentUE',{toolbars: [
[ 'anchor', //锚点
'undo', //撤销
'redo', //重做
'bold', //加粗
'indent', //首行缩进
'italic', //斜体
'underline', //下划线
'strikethrough', //删除线
'subscript', //下标
'fontborder', //字符边框
'superscript', //上标
'formatmatch', //格式刷
'blockquote', //引用
'pasteplain', //纯文本粘贴模式
'selectall', //全选
'preview', //预览
'horizontal', //分隔线
'removeformat', //清除格式
'time', //时间
'date', //日期
'unlink', //取消链接
'insertrow', //前插入行
'insertcol', //前插入列
'mergeright', //右合并单元格
'mergedown', //下合并单元格
'deleterow', //删除行
'deletecol', //删除列
'splittorows', //拆分成行
'splittocols', //拆分成列
'splittocells', //完全拆分单元格
'deletecaption', //删除表格标题
'inserttitle', //插入标题
'mergecells', //合并多个单元格
'deletetable', //删除表格
'cleardoc', //清空文档
'insertparagraphbeforetable', //"表格前插入行"
'fontfamily', //字体
'fontsize', //字号
'paragraph', //段落格式
'simpleupload', //单图上传
'insertimage', //多图上传
'edittable', //表格属性
'edittd', //单元格属性
'link', //超链接
'spechars', //特殊字符
'searchreplace', //查询替换
'help', //帮助
'justifyleft', //居左对齐
'justifyright', //居右对齐
'justifycenter', //居中对齐
'justifyjustify', //两端对齐
'forecolor', //字体颜色
'backcolor', //背景色
'insertorderedlist', //有序列表
'insertunorderedlist', //无序列表
/* 'fullscreen', //全屏 */
'directionalityltr', //从左向右输入
'directionalityrtl', //从右向左输入
'rowspacingtop', //段前距
'rowspacingbottom', //段后距
'pagebreak', //分页
'imagenone', //默认
'imageleft', //左浮动
'imageright', //右浮动
'attachment', //附件
'imagecenter', //居中
'lineheight', //行间距
'edittip ', //编辑提示
'autotypeset', //自动排版
'touppercase', //字母大写
'tolowercase', //字母小写
'inserttable', //插入表格
]],
autoClearinitialContent:true,
//关闭字数统计
wordCount:false,
//关闭elementPath
elementPathEnabled:false,
//默认的编辑区域高度
initialFrameHeight:300});
</script>
记住,我这里的ue富文本的图标还是不全的,去掉了一些奇奇怪怪的功能
6.到现在
最起码的百度ue应该能看到了,至于ue包的导入看我前面的博客