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

How can I set default font Verdana in CKEditor?

本文关键字:默认 字体 Verdana 设置 CKEditor      更新时间:2023-09-26

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。如何在初始化时设置默认字体。

在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;
}