我想增加富文本编辑器“ckeditor”的字体大小。
这个页面的第一个演示(http://ckeditor.com/demo#toolbar)我正在使用。我想让正文的字体大小为 44px。
我找到了这个链接http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-toolbarGroups。看来我可以从此页面配置我的字体大小。但仍然无法指出哪个配置适合增加字体大小。
我想增加富文本编辑器“ckeditor”的字体大小。
这个页面的第一个演示(http://ckeditor.com/demo#toolbar)我正在使用。我想让正文的字体大小为 44px。
我找到了这个链接http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-toolbarGroups。看来我可以从此页面配置我的字体大小。但仍然无法指出哪个配置适合增加字体大小。
您可以使用 setStyles 功能:
CKEDITOR.replace('editor1', {
on: {
instanceReady: function (evt) {
evt.editor.document.getBody().setStyles({color: 'black', 'font-size': '72px'})
}
}
}
添加一个contents.css来修改编辑器中显示的内容的默认字体和大小:
body {
font-family: Arial;
font-size: 44px;
}
并设置:
config.font_defaultLabel = 'Arial';
config.fontSize_defaultLabel = '44px';
config.contentsCss
请参阅文档:
打开 /ckeditor/ 目录中的 contents.css 你可以改变字体大小:
background-color: #ffffff;
font-size:16px; /* Just added this */
只需将此添加到您的页面
CKEDITOR.replace('editor1', {
on: {
instanceReady: function (evt) {
evt.editor.document.getBody().setStyles({color: 'black', 'font-size': '18px', 'font-family': 'Verdana'})
}
}
});
我正在使用 ckeditor 4.4.6 并更改 content.css 工作,请注意更改“body”类不起作用,需要更改“.cke_editable”类。