简体   繁体   English

如何更改 Ckeditor 的默认字体?

[英]How Can i change default font of Ckeditor?

I like to change default font of Ckeditor !我喜欢更改 Ckeditor 的默认字体!

I cant do it and dont see anything about it in Docs .我不能这样做,也没有在 Docs 中看到任何关于它的信息。 I can only change the default lable of it !我只能更改它的默认标签!

Thanks谢谢

Per the docs these all seem to be defined in plugins/font/plugin.js.根据文档,这些似乎都在plugins/font/plugin.js 中定义

{Object} CKEDITOR.config.font_style The style definition to be used to apply the font in the text. {Object} CKEDITOR.config.font_style 用于在文本中应用字体的样式定义。 Defined in: plugins/font/plugin.js.定义在:plugins/font/plugin.js。

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

{String} CKEDITOR.config.fontSize_defaultLabel Since: 3.0 The text to be displayed in the Font Size combo is none of the available values matches the current cursor position or text selection. {String} CKEDITOR.config.fontSize_defaultLabel 自:3.0 字体大小组合中显示的文本是没有任何可用值与当前光标位置或文本选择匹配的。 Defined in: plugins/font/plugin.js.定义在:plugins/font/plugin.js。

 config.fontSize_defaultLabel = '12px';

{String} CKEDITOR.config.fontSize_sizes Since: 3.0 The list of fonts size to be displayed in the Font Size combo in the toolbar. {String} CKEDITOR.config.fontSize_sizes 从以下版本开始:3.0 要在工具栏的“字体大小”组合中显示的字体大小列表。 Entries are separated by semi-colons (;).条目由分号 (;) 分隔。 Any kind of "CSS like" size can be used, like "12px", "2.3em", "130%", "larger" or "x-small".可以使用任何类型的“类似 CSS”的大小,例如“12px”、“2.3em”、“130%”、“更大”或“x-small”。 A display name may be optionally defined by prefixing the entries with the name and the slash character.可以通过在条目前面加上名称和斜杠字符来选择性地定义显示名称。 For example, "Bigger Font/14px" will be displayed as "Bigger Font" in the list, but will be outputted as "14px".例如,“Bigger Font/14px”在列表中会显示为“Bigger Font”,但会输出为“14px”。 Defined in: plugins/font/plugin.js.定义在: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';

I am not very savvy with Ckeditor, but I hope this helps!我对 Ckeditor 不是很了解,但我希望这会有所帮助!

In config.js :config.js

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

In fonts.css :fonts.css

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

Now, it may be all right.现在,可能没事了。 if you want this font to be styled with body tag, you should add this in fonts.css :如果你想用 body 标签设置这个字体的样式,你应该在fonts.css添加:

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

In order to change toolbar style, what worked for me was this:为了更改工具栏样式,对我有用的是:
In skins/moono-lisa/editor.css :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`

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM