2015-01-21 61 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 
     }, 
    }); 

祝您好運!