Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom toolbar with Summernote

How do I know which functions can be enabled for the toolbar of summernote, and how to do it?

In the API docs all I can find is "toolbar : Array (optional)" without further explanation.

I've managed to enable some features thanks to one of the examples, but how can I also enable: code, indent and outdent?

$(".summernote").summernote({     styleWithSpan: false,     toolbar: [         ['style', ['bold', 'italic', 'underline', 'clear']],         ['color', ['color']],         ['para', ['ul', 'ol']]     ] }); 
like image 998
Publicus Avatar asked Mar 02 '15 14:03

Publicus


People also ask

How do I customize my Summernote toolbar?

If you look on the main Summernote website as opposed to the API docs you will see a clear example, that explains how to customise the toolbar. It is on the Deep Dive page and scroll down to Custom Toolbar. It also lists the available toolbar buttons. In your toolbar you set ['style', ['bold', 'italic',...

How do I add plugins to Summernote?

Adding a Plugin We typically load the Plugin Script after loading the Summernote Script. Most scripts are added in the head area of the typical HTML page. Other things that may need to be loaded along with the plugin file, might be language files, which should follow the plugin inclusion.

How do I turn off drag and drop in Summernote?

You can disable drag and drop with the disableDragAndDrop option.


2 Answers

in settings.js You have basic setting (with all features on):

toolbar: [     ['style', ['style']],     ['font', ['bold', 'italic', 'underline', 'clear']],     ['fontname', ['fontname']],     ['color', ['color']],     ['para', ['ul', 'ol', 'paragraph']],     ['height', ['height']],     ['table', ['table']],     ['insert', ['link', 'picture', 'hr']],     ['view', ['fullscreen', 'codeview']],     ['help', ['help']]   ], 

indentation is in 'paragraph'

like image 144
Sqrcz Avatar answered Sep 20 '22 22:09

Sqrcz


paragraph includes indent and outdent, codeview as it suggests does codeview.

$('.summernote').summernote({     toolbar: [         //[groupname, [button list]]          ['style', ['bold', 'italic', 'underline', 'clear']],         ['color', ['color']],         ['para', ['ul', 'ol', 'paragraph']],         ['view', ['codeview']],     ] }); 

If you look on the main Summernote website as opposed to the API docs you will see a clear example, that explains how to customise the toolbar. It is on the Deep Dive page and scroll down to Custom Toolbar. It also lists the available toolbar buttons.

http://summernote.org/#/deep-dive#custom-toolbar

like image 43
Lee Avatar answered Sep 23 '22 22:09

Lee