Search code examples
javascriptwysiwygsummernote

How do you get fontsize toolbar on summernote v0.6.0


The example given on the Summernote website is:

$('.summernote').summernote({
  toolbar: [
    //[groupname, [button list]]

    ['style', ['bold', 'italic', 'underline', 'clear']],
    ['font', ['strikethrough']],
    ['fontsize', ['fontsize']],
    ['color', ['color']],
    ['para', ['ul', 'ol', 'paragraph']],
    ['height', ['height']],
  ]
});

This does not appear to display either the strikethrough option or the fontsize option in version 0.6.0

There is some talk that the fontsize has been extracted to a plugin, but if so I cant find any documentation on how to use it.


Solution

  • The fontsize option has indeed been separated into a plugin. There is a file summernote-ext-fontstyle.js in the plugins folder of the Summernote download.

    This must be loaded after the main summernote javascript.

    After that you just have to do the toolbar as in the examples given:

    $('.summernote').summernote({
      toolbar: [
        //[groupname, [button list]]
        ['fontsize', ['fontsize']],
        ['etc', ['etc']],
      ]
    });