Настроить панель инструментов WYSIHTML5

Как настроить панель инструментов в WYSIHTML5. Я хочу отключить размер шрифта и кнопки вставки изображения, особенно для версии WYSIHTML5, используемой в Bootstrap X-editable.


person user2694939    schedule 19.08.2013    source источник


Ответы (3)


Если вы используете bootstrap-wysiwyg/bootstrap3-wysiwyg (который, например, используется gem bootstrap-wysihtml5-rails), начиная с версии 3.0, вам нужно будет вложить его внутрь панель инструментов:

$('#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
  }
});
person mdemolin    schedule 10.12.2014

Вы можете отключить опции панели инструментов, используя параметры запуска:

$('#[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
});

Эта информация должна быть вставлена ​​в тег:

<head>
   <script> HERE </scrip>
</head>
person Renan Barreiro    schedule 11.09.2013

Вы можете сделать это через CSS

ul.wysihtml5-toolbar li a[title="Insert image"] { display: none; }
ul.wysihtml5-toolbar li.dropdown { display: none; }
person Michael Bridak    schedule 22.08.2013