如何在CKEditor中设置默认字体Verdana?

时间:2014-04-18 12:07:28

标签: javascript jquery ckeditor

HTML代码:

    <textarea name="editor" id="editor" rows="9" style='width:79%;'></textarea>

初始化:

    <script>
    CKEDITOR.replace('editor', {toolbar: [
    {name: 'basicstyles', groups: ['basicstyles', 'cleanup'], items: ['Bold', 'Italic', 'Underline', '-', 'TextColor', 'BGColor']},
    {name: 'styles', items: ['Font', 'FontSize']},
    {name: 'insert', items: ['Image']},
    {name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align', 'bidi'], items: ['NumberedList', 'BulletedList', '-', 'Blockquote', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock']},
    ]
 });
</script>

现在,我想设置默认字体Verdana。如何在初始化时设置默认字体。

1 个答案:

答案 0 :(得分:0)

在ckeditor的config.js中添加以下行

  config.font_defaultLabel = 'verdana';
  config.fontSize_defaultLabel = '12px';
  config.contentsCss = ['../contents.css'].concat(myFonts);

添加

    body
{
    /* Font */
    font-family: verdana;
    font-size: 12px;

    /* Text color */
    color: #333;

    /* Remove the background color to make it transparent */
    background-color: #fff;

    margin: 20px;
}