Customize WYSIHTML5 Toolbar
Asked Answered
B

3

8

How do you customize the toolbar in WYSIHTML5. I want to disable the font size and image insert buttons, particularly for the WYSIHTML5 version used in Bootstrap X-editable.

Because answered 19/8, 2013 at 2:4 Comment(0)
D
20

If you happen to use bootstrap-wysiwyg/bootstrap3-wysiwyg (which is for example used by gem bootstrap-wysihtml5-rails), since version 3.0, you will need to nest it inside toolbar :

$('#some-textarea').wysihtml5({
  toolbar: {
    "font-styles": true, // Font styling, e.g. h1, h2, etc.
    "emphasis": true, // Italics, bold, etc.
    "lists": true, // (Un)ordered lists, e.g. Bullets, Numbers.
    "html": false, // Button which allows you to edit the generated HTML.
    "link": true, // Button to insert a link.
    "image": true, // Button to insert an image.
    "color": false, // Button to change color of font
    "blockquote": true, // Blockquote
    "size": <buttonsize> // options are xs, sm, lg
  }
});
Deb answered 10/12, 2014 at 16:57 Comment(0)
T
13

You can disable toolbar options using startup parameters:

$('#[YOUR INPUT ID]').wysihtml5({
     "font-styles": false, //Font styling, e.g. h1, h2, etc.
     "emphasis": true, //Italics, bold, etc.
     "lists": true, //(Un)ordered lists, e.g. Bullets, Numbers.
     "html": true, //Button which allows you to edit the generated HTML.
     "link": true, //Button to insert a link.
     "image": false, //Button to insert an image.
     "color": true //Button to change color of font
});

This info should be pasted in the tag:

<head>
   <script> HERE </scrip>
</head>
Transmissible answered 11/9, 2013 at 19:30 Comment(0)
O
7

You can do it through CSS

ul.wysihtml5-toolbar li a[title="Insert image"] { display: none; }
ul.wysihtml5-toolbar li.dropdown { display: none; }
Ormolu answered 22/8, 2013 at 16:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.