ckeditor - CKEditor 4 - 如何将 H2、H3 等添加到工具栏
问题描述
查看这些文档:https ://ckeditor.com/docs/ckeditor4/latest/features/styles.html
所以添加样式集应该是这样的,但我无法让 H2 或 H3 项目出现在我的工具栏中:
CKEDITOR.stylesSet.add( 'my_styles', [
// Block-level styles
{ name: 'Blue Title', element: 'h2', styles: { 'color': 'Blue' } },
{ name: 'Red Title' , element: 'h3', styles: { 'color': 'Red' } },
// Inline styles
{ name: 'CSS Style', element: 'span', attributes: { 'class': 'my_style' } },
{ name: 'Marker: Yellow', element: 'span', styles: { 'background-color': 'Yellow' } }
] );
CKEDITOR.editorConfig = function( config ) {
config.extraPlugins = 'firstname,MediaEmbed,justify,image';
//config.forcePasteAsPlainText = true;
config.extraAllowedContent = 'iframe[*]';
config.toolbar = 'Normal';
config.toolbar_Normal = [
{ name: 'basicstyles', items: [ 'Bold', 'Italic','Underline','Strike' ] },
{ name: 'paragraph', items: [ 'NumberedList', 'BulletedList', 'JustifyLeft', 'JustifyCenter', 'JustifyRight' ] }
];
config.toolbar_Emails = [
{ name: 'basicstyles', items: [ 'Bold', 'Italic','Underline','Strike' ] },
{ name: 'paragraph', items: [ 'NumberedList', 'BulletedList', 'JustifyLeft', 'JustifyCenter', 'JustifyRight' ] }
];
config.removeDialogTabs = 'link:advanced;link:target';
config.stylesSet = 'my_styles';
};
解决方案
如文档中所述
打开config.js
目录中可用的文件ckeditor
,并按以下方式编辑config.format_tags
条目以显示文本格式工具栏。
// Enable all default text formats:
config.format_tags = 'p;h1;h2;h3;h4;h5;h6;pre;address;div';
// Enable a limited set of text formats:
config.format_tags = 'p;h1;h2;pre;div';
推荐阅读
- arrays - .get 调用后反应转换 JSON 数组
- python - 如何在每个请求上使用 selenium python 轮换各种用户代理
- git - Git(GitFlow)完成发布错误:Code.exe:没有这样的文件或目录
- output - 输出文件迭代分辨率
- c++ - 子数组的最小排除值
- r - 问:R 使用 OpenStreetMap 数据在地图上绘制建筑物占地面积/轮廓
- python - 如何在 Python 3 中使用 __dict__ 为类的 __init__() 中的类添加属性?
- c++ - 将文本文件中的邻接列表读入地图
- sql - 如何输出最大值
- java - android studio - android 视图未正确列出文件夹