John S
John S

Reputation: 8351

x-editable and bootstrap-wysihtml5 toolbar configuration as data-wysihtml5

I am trying to use x-editable with the wysihtml5 data-type setting to get an inline editor for a span

<span id="username" class="editable" data-type="wysihtml5" data-pk="2"
 data-content="Content" data-wysihtml5="{'link':false}" data-url="/home/SaveEdits" 
data-title="Enter username">My editable content goes here.</span>

My JQuery is:

 $.fn.editable.defaults.mode = 'inline';
$('.editable').editable();

What I would like to do is remove some of the buttons from the toolbar. The docs say this can be done by editing the data-wysihtml5 value in the span. But this doesn't seem to work. What am I missing?

Upvotes: 1

Views: 1538

Answers (1)

Eugen Zaharia
Eugen Zaharia

Reputation: 179

I'm not sure if configuration works through data attribute and in my opinion you end with an ugly markup. You better try customizing toolbar using JS/Jquery like the following:

    $('.editable').editable({
        url: '/post',
        title: 'Enter comments',
        showbuttons: 'bottom',
        onblur: 'ignore',
        wysihtml5: {
          "image": false,
          "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
       },
    });

Good luck!

Upvotes: 1

Related Questions