浅用HTML编辑器ueditor

来源:互联网 发布:asynchttp post json 编辑:程序博客网 时间:2024/05/01 16:48

UEditor是由百度web前端研发部开发的web编辑器,一个学长推荐我去看一下,的确很好用。

先上官网看一下,有好多版本。Ubuilder是比较精简的一个版本,我要把 编辑器运用到项目中,所以选用了开发版的。


把下载的压缩包打开,里面就有demo。

在根目录下有两个js文件很重要一个是编辑器源码文件ueditor.all.js和配置文件ueditor.config.js

在config.js文件下可以根据需要修改工具栏


        , toolbars: [[            'fullscreen', 'source', '|', 'undo', 'redo', '|',            'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',            'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',            'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',            'directionalityltr', 'directionalityrtl', 'indent', '|',            'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',            'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',            'simpleupload', 'insertimage', 'emotion', 'scrawl', 'insertvideo', 'music', 'attachment', 'map', 'gmap', 'insertframe', 'insertcode', 'webapp', 'pagebreak', 'template', 'background', '|',            'horizontal', 'date', 'time', 'spechars', 'snapscreen', 'wordimage', '|',            'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', 'charts', '|',            'print', 'preview', 'searchreplace', 'drafts', 'help'        ]]

但是我需要的编辑器比较精简,所以我就做了些修改。

这是我在最后项目中的效果:


哎,可是还有个bug没有解决,好烦。。。编辑器的高度会改变。。。

0 0
原创粉丝点击