2016-06-15 15 views
2

私はいくつかのコードビットを入れることができるボックスを作成するSummernoteのボタンを作りたいと思います。このようSummernote codeblock button

enter image description here

それは動作しますが、私は今、ボックスの外側tekstを置くことはできません。

これは私のコードです:この問題を解決する方法を知っている

javascript: 
 

 
    var HelloButton = function (context) { 
 
     var ui = $.summernote.ui; 
 
    
 
     // create button 
 
     var button = ui.button({ 
 
      contents: 'Code block', 
 
      tooltip: 'hello', 
 
      click: function() { 
 
    
 
       $('#notes').summernote('code', '<pre><code class="html">Place your code here.</code></pre>'); 
 
    } 
 
    }); 
 

 
    return button.render(); // return button as jquery object 
 
} 
 

 
$('#notes').summernote({ 
 
    
 
    minHeight: 200, 
 
       toolbar: [ 
 
\t \t \t \t \t ['style', ['style']], 
 
        ['mybutton', ['hello']], 
 
\t \t \t \t \t ['font', ['bold', 'italic', 'underline', 'clear']], 
 
\t \t \t \t \t ['para', ['ul', 'ol']], 
 
\t \t \t \t \t ['height', ['height']], 
 
\t \t \t \t \t ['insert', ['link', 'picture']], 
 
\t \t \t \t \t ['view', ['fullscreen', 'codeview']], 
 
\t \t \t \t \t ['help', ['help']] 
 
\t \t \t \t ], 
 
       
 
       buttons: { 
 
        hello: HelloButton 
 
       } 
 
});
html: 
 

 
<textarea name="note" id="notes"> 
 

 
</textarea>

誰か?

答えて

0

問題を解決しました。 'code'の代わりに 'editor.pasteHTML'を使用しなければなりませんでした。

関連する問題