How to customize fonts in CKEditor?

浪子不回头ぞ 提交于 2019-12-08 16:56:57

问题


Does anyone know how to customize (add or remove) fonts in the CKEditor 3.x series? I looked all over and I can't figure out how. Supposedly there is a /plugin/fonts folder but it does not exist in 3.5+ of CKEditor.


回答1:


The fonts in the font menu are configured using CKEDITOR.config.font_names:

<static> {String} CKEDITOR.config.font_names

The list of fonts names to be displayed in the Font combo in the toolbar. [...]

So all you need to do is set font_names in your configuration to the font names you want, for example:

config.font_names =
    'Arial/Arial, Helvetica, sans-serif;' +
    'Times New Roman/Times New Roman, Times, serif;' +
    'Verdana';

Will give you these font names in the menu:

  • Arial
  • Times New Roman
  • Verdana


来源:https://stackoverflow.com/questions/6393382/how-to-customize-fonts-in-ckeditor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!