Twitter bootstrap 3 bootstrap3 wysiwyg-删除“凸出”和“缩进”按钮

Twitter bootstrap 3 bootstrap3 wysiwyg-删除“凸出”和“缩进”按钮,twitter-bootstrap-3,Twitter Bootstrap 3,如何从工具栏中删除“凸出”和“缩进”按钮。我找到了一个选项,可以删除存储按钮的列表,但不能删除按钮。有可能吗。我试过这个,但不起作用: $('.editor').wysihtml5({ toolbar: { "font-styles": true, //Font styling, e.g. h1, h2, etc. Default true "emphasis": true, //Italics, bold, etc. Defaul

如何从工具栏中删除“凸出”和“缩进”按钮。我找到了一个选项,可以删除存储按钮的列表,但不能删除按钮。有可能吗。我试过这个,但不起作用:

    $('.editor').wysihtml5({
        toolbar: {
          "font-styles": true, //Font styling, e.g. h1, h2, etc. Default true
          "emphasis": true, //Italics, bold, etc. Default true
          "lists": true, //(Un)ordered lists, e.g. Bullets, Numbers. Default true
          "html": false, //Button which allows you to edit the generated HTML. Default false
          "link": true, //Button to insert a link. Default true
          "image": true, //Button to insert an image. Default true,
          "color": false, //Button to change color of font
          "blockquote": true, //Blockquote
        },
        lists: {
          unordered: 'Unordered list',
          ordered: 'Ordered list',
        },

});

回答这个问题有点晚了,但万一这对任何人都有帮助

快速(脏)方式-使用CSS隐藏按钮:

a[data-wysihtml5-command="Outdent"],
a[data-wysihtml5-command="Indent"] {
    display:none !important;
}
更好的解决方案是使用自定义模板:

var myCustomTemplates = {
    emphasis : function(locale) {
        return "<li>" +
            "<div class='btn-group'>" +
            "<a data-wysihtml5-command='bold' title='Bold' class='btn btn-none btn-default' ><span style='font-weight:700'>B</span></a>" +
            "<a data-wysihtml5-command='italic' title='Italics' class='btn btn-none btn-default' ><span style='font-style:italic'>I</span></a>" +
            "<a data-wysihtml5-command='underline' title='Underline' class='btn btn-none btn-default' ><span style='text-decoration:underline'>U</span></a>" +
            "</div>" +
            "</li>";
    },
    lists : function(locale) {
        return "<li>" +
            "<div class='btn-group'>" +
            "<a data-wysihtml5-command='insertUnorderedList' title='Unordered list' class='btn btn-none btn-default' ><span class='fa fa-list-ul'></span></a>" +
            "<a data-wysihtml5-command='insertOrderedList' title='Ordered list' class='btn btn-none btn-default' ><span class='fa fa-list-ol'></span></a>" +
            //"<a data-wysihtml5-command='Outdent' title='Outdent' class='btn btn-none btn-default' ><span class='fa fa-outdent'></span></a>" +
            //"<a data-wysihtml5-command='Indent' title='Indent' class='btn btn-none btn-default'><span class='fa fa-indent'></span></a>" +
            "</div>" +
            "</li>";
    }
}

$('.texteditor').wysihtml5({
    toolbar: {
        "font-styles": false, //Font styling, e.g. h1, h2, etc. Default true
        "emphasis": true, //Italics, bold, etc. Default true
        "lists": true, //(Un)ordered lists, e.g. Bullets, Numbers. Default true
        "html": true, //Button which allows you to edit the generated HTML. Default false
        "link": true, //Button to insert a link. Default true
        "image": false, //Button to insert an image. Default true,
        "color": false, //Button to change color of font
        "blockquote": false, //Blockquote
    },
    customTemplates: myCustomTemplates
});
var myCustomTemplates={
强调:功能(区域设置){
返回“
  • ”+ "" + “B”+ “我”+ “U”+ "" + “
  • ”; }, 列表:函数(区域设置){ 返回“
  • ”+ "" + "" + "" + //"" + //"" + "" + “
  • ”; } } $('.texteditor').wysihtml5({ 工具栏:{ “字体样式”:false,//字体样式,例如h1、h2等。默认为true “emphasis”:true、//斜体、粗体等。默认为true “列表”:true,//(未排序的)列表,例如项目符号、数字。默认为true “html”:true,//按钮,允许您编辑生成的html。默认为false “link”:true,//插入链接的按钮。默认值为true “image”:false,//插入图像的按钮。默认为true, “color”:false,//更改字体颜色的按钮 “blockquote”:false,//blockquote }, customTemplates:myCustomTemplates });
    因此,上面的自定义模板仅返回前两个列表模板按钮

    (由于最后2个在模板中被注释掉)

    此外,它还可以调整强调模板中的样式按钮 到B I U