如何更改 Ckeditor 的默认字体?

How Can i change default font of Ckeditor?

我想更改 Ckeditor 的默认字体!

我做不到,在文档中也看不到任何相关信息。 我只能更改它的默认标签!

谢谢

根据 docs 这些似乎都在 plugins/font/plugin.js.

中定义

{对象} CKEDITOR.config.font_style 用于在文本中应用字体的样式定义。 定义于:plugins/font/plugin.js.

config.font_style =
    {
        element  : 'span',
        styles  : { 'font-family' : '#(family)' },
        overrides : [ { element : 'font', attributes : { 'face' : null } } ]
    };

{String} CKEDITOR.config.fontSize_defaultLabel 自:3.0 要在字体大小组合中显示的文本是 none 个可用值,与当前光标位置或文本选择相匹配。 定义于:plugins/font/plugin.js.

config.fontSize_defaultLabel = '12px';

{String} CKEDITOR.config.fontSize_sizes 自:3.0 要在工具栏的字体大小组合中显示的字体大小列表。条目由分号 (;) 分隔。可以使用任何类型的 "CSS like" 大小,例如“12px”、“2.3em”、“130%”、"larger" 或 "x-small"。可以通过在条目前加上名称和斜杠字符来选择性地定义显示名称。例如,"Bigger Font/14px" 在列表中显示为 "Bigger Font",但输出为“14px”。 定义于:plugins/font/plugin.js.

config.fontSize_sizes = '16/16px;24/24px;48/48px;';
config.fontSize_sizes = '12px;2.3em;130%;larger;x-small';
config.fontSize_sizes = '12 Pixels/12px;Big/2.3em;30 Percent More/130%;Bigger/larger;Very Small/x-small';

我对 Ckeditor 不是很了解,但我希望这对您有所帮助!

config.js中:

config.contentsCss = '/ckeditor/fonts.css';
config.font_names = 'shabnam';

fonts.css中:

@font-face {
   font-family: "shabnam";
   src: url("/fonts/Shabnam.ttf") format('truetype');
}

现在,可能一切都好了。 如果你想让这个字体带有 body 标签的样式,你应该在 fonts.css:

中添加
body {
  /* Font */
  font-family: "shabnam";
}

为了更改工具栏样式,对我有用的是:
skins/moono-lisa/editor.css:

delete `font:normal normal normal 12px Arial,Helvetica,Tahoma,Verdana,Sans-Serif;` from 
     `.cke_reset_all,.cke_reset_all *,.cke_reset_all a,.cke_reset_all textarea`