2016-05-04 26 views
2

私は基本的なCMSで編集するためにsummernoteを使用しています。私は、ユーザーがH1Pような見出し/段落スタイルを選択できるように['para',['style']]を使用してツールバーでSummernoteの利用可能な段落スタイルを制限する方法はありますか?

$(document).ready(function() { 

     $("#summernote").summernote({ 
      height: 600, 
       styleWithSpan: false, 
       toolbar: [ 
        ['style', ['bold', 'italic', 'underline']], 
        ['para', ['ul', 'ol', 'paragraph','style']], 
        ['view', ['codeview']], 
        ['insert', ['mypicture','link','table','hr']] 
         ], 
         buttons: { 
          mypicture: PictureButton 
          }, 
          disableDragAndDrop: true 
       }); 

       $('#save').click(function(){ 
        var mysave = $('#summernote').summernote('code'); 
        $('#content').val(mysave); 
       }); 
    }); 

を:ここで私が使用していたコードです。
のみ彼らはH1H2、およびPを使用することができるようにドロップダウンを制限する方法はありますか?

答えて

1

あなたは簡単にこの方法の関連行がstyleTags: ['p', 'h1', 'h2']ある

$(document).ready(function() { 

     $("#summernote").summernote({ 
      height: 600, 
       styleWithSpan: false, 
       toolbar: [ 
         ['style', ['bold', 'italic', 'underline']], 
         ['para', ['ul', 'ol', 'paragraph','style']], 
        ['view', ['codeview']], 
        ['insert', ['mypicture','link','table','hr']] 
       ], 
       styleTags: ['p', 'h1', 'h2'], 
       buttons: { 
        mypicture: PictureButton 
       }, 
       disableDragAndDrop: true 

       }); 

       $('#save').click(function(){ 
        var mysave = $('#summernote').summernote('code'); 
        $('#content').val(mysave); 
       }); 
    }); 

あなたのコードを変更することにより、それを達成することができます。

関連する問題