font-family option in summernote not working

user3844820 picture user3844820 · Dec 17, 2015 · Viewed 14.3k times · Source

fontfamily option is not working in summernote I tried

$("#divCalltoactiontitle").summernote({
        toolbar: [

            ['font', ['bold', 'italic', 'underline', 'clear']],
            ['fontsize', ['fontsize']], 
        ],
        fontNames: [
    'Serif', 'Sans', 'Arial', 'Arial Black', 'Courier',
    'Courier New', 'Comic Sans MS', 'Helvetica', 'Impact', 'Lucida Grande',
    'Sacramento'
        ],

    } );

Answer

Hacker Wins picture Hacker Wins · Feb 6, 2016

It seems that you missed fontname on your toolbar settings. fontNames options is just setup font items.

toolbar: [
  ['fontname', ['fontname']
]

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

For more about toolbar settings, please refer to default toolbar settings.

toolbar settings: https://github.com/summernote/summernote/blob/develop/src/js/bs3/settings.js#L67

fontNames settings: https://github.com/summernote/summernote/blob/develop/src/js/bs3/settings.js#L112