自定义配置UEditor 工具栏上的按钮列表

修改配置项的方法: 1. 方法一:修改 ueditor.config.js 里面的 toolbars 2. 方法二:实例化编辑器的时候传入 toolbars 参数html

方法一:在ueditor.config.js中web

        //工具栏上的全部的功能按钮和下拉框,能够在new编辑器的实例时选择本身须要的从新定义
        , 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'
            // 'fullscreen', 'source', 'undo', 'redo', 'bold'
        ]]

toolbars:里的值修改为你想要的就能够了.app

默认没修改:                                                                                                               , toolbars: [[            'fullscreen', 'source', 'undo', 'redo', 'bold']]时页面效果webapp

方法二:实例化编辑器的时候传入 toolbars 参数编辑器

var ue = UE.getEditor('editor',
  {
    toolbars: [[
               'fullscreen', 'source','|', 'undo', 'redo', 'bold'
           ]],
   });
//对编辑器的操做最好在编辑器ready以后再作
ue.ready(function() {
    //设置编辑器的内容
    ue.setContent('hello--editor');
    //获取html内容,返回: <p>hello</p>
    var html = ue.getContent();
    //获取纯文本内容,返回: hello
    var txt = ue.getContentTxt();
    console.log(txt);
});
相关文章
相关标签/搜索