editor.md删除工具栏中不需要的按钮

editor.md很好用,默认工具栏的按钮很多很强大,但有些用不上,editor.md为我们配置了三种模式,在editormd.js文件中的第66行上下,如图:

editor.md为我们配置了全部、简单、迷你三种,如果不满足需求,还可以在配置中自定义,代码如下:

//加载markdown
    $(function() {
        editormd("editormd-box", {
            width   : "95%",
            height  : 640,
            syncScrolling : "single",
            //你的lib目录的路径,我这边用JSP做测试的
            path    : "${domain}/editor.md/lib/",
            toolbarIcons : function() {
                return ["undo", "redo", "|", 
                        "bold", "del", "italic", "quote", "|", 
                        "h1", "h2", "h3", "h4", "h5", "h6", "|", 
                        "list-ul", "list-ol", "hr", "|",
                        "link", "image", "code-block", "table", "emoji", "|",
                         "watch", "|",
                        "help", "info"]
            },
            emoji : true,
            //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。
            saveHTMLToTextarea : true,
            imageUpload : true,
            imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
            imageUploadURL : "${domain}/ajaxApi/imageUploadForEditormd"
        });
    });

注意第9行至第11行是自定义工具栏按钮的方法


原文出处:/show_1C7L9wo8xK5.html