summernote中的font-family选项不起作用

时间:2015-12-17 14:05:33

标签: summernote

fontfamily选项在summernote中不起作用 我试过了

$("#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'
        ],

    } );

2 个答案:

答案 0 :(得分:6)

您似乎错过了工具栏设置中的fontnamefontNames选项只是设置字体项。

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

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

有关工具栏设置的更多信息,请参阅默认工具栏设置。

工具栏设置: https://github.com/summernote/summernote/blob/develop/src/js/bs3/settings.js#L67

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

答案 1 :(得分:1)

fontNames选项是告诉Summernote在 fontFamily下拉列表中显示的内容

  

但是,Summernote在添加之前测试fontNames中的字体   落下。这是使用Web字体时的问题。这不容易采摘   很好的时间来检查网络字体的可用性。你可以定义一个   要使用fontNamesIgnoreCheck忽略的网络字体列表。

参考:http://summernote.org/deep-dive/#initialization-options

因此,您可能还需要添加fontNamesIgnoreCheck选项。

fontNames: [ 'Serif', 'Sans', 'Arial', 'Arial Black', 'Courier', 'Courier New', 'Comic Sans MS', 'Helvetica', 'Impact', 'Lucida Grande', 'Sacramento'],
fontNamesIgnoreCheck: [ 'Serif', 'Sans', 'Arial', 'Arial Black', 'Courier', 'Courier New', 'Comic Sans MS', 'Helvetica', 'Impact', 'Lucida Grande', 'Sacramento'],

Summernote还会检查浏览器的当前字体系列和字体大小,以初始化默认字体系列和字体大小。

通常以body风格找到。如果您将body的样式设置为:

body {
   font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
   font-size: 16px;
}

Summernote将Helvetica Neue16px分别显示为默认字体样式和默认字体大小。

相关问题