2015-01-21 85 views
1

我试图用x-编辑与wysihtml5数据类型设置得到一个行内编辑针对跨距X编辑和引导,wysihtml5工具栏配置数据wysihtml5

<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> 

我jQuery是:

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

我想要做的是从工具栏中删除一些按钮。文档说这可以通过在span中编辑data-wysihtml5值来完成。但这似乎并不奏效。我错过了什么?

回答

0

我不确定配置是否可以通过数据属性工作,并且我认为您以丑陋的标记结束。您最好尝试使用JS/Jquery自定义工具栏,如下所示:

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

祝您好运!