2016-01-14 34 views
1

如何從工具欄中移除超長按鈕和縮進按鈕。我發現刪除列表的按鈕存儲在哪裏,但沒有按鈕的選項。可能嗎。我試過這個,但是這不起作用:bootstrap3-wysiwyg - 刪除超長按鈕並縮進按鈕

$('.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', 
     }, 

}); 

回答

0

有點晚,這個答案,但萬一這有助於任何人。

a[data-wysihtml5-command="Outdent"], 
a[data-wysihtml5-command="Indent"] { 
    display:none !important; 
} 

更好的解決方案是使用自定義模板: -

快速(髒)的方式使用CSS隱藏按鈕

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 
}); 

因此,自定義模板上面僅返回第2列出模板按鈕

(因爲最後2個在模板中被註釋掉),

加上它也調整強調模板 中的造型按鈕到B我U