在CKEditor中的自定义样式中,我创建了一个"提示"我希望跨越一个或多个段落的块元素。但是,当我编辑我的文本时(使用内联编辑器),我无法让块样式跨多个段落工作。
我的风格如下:
CKEDITOR.stylesSet.add('authorStyles', [
// Block-level styles
{
name: 'Yellow Tip',
element: 'p',
styles: {
margin: '1em 0',
padding: '20px 20px 4px',
border: '1px solid',
'border-radius': '15px',
'background-color': '#FFC',
'border-color': '#CC9'
}
}
]);
在config.js中,我添加了一行来连接自定义样式
// custom styles
config.stylesSet = 'authorStyles:../authorStyle.js';
这是我的HTML:
<div class="section right" contenteditable="true" id="contentToSubmit">
<p>Here we have some addtional content that is also editable as well in addition to being just some text on its own right.</p>
<p>Here we have some addtional content that is also editable as well in addition to being just some text on its own right.</p>
<p>Here we have some addtional content that is also editable as well in addition to being just some text on its own right.</p>
<p>Here we have some addtional content that is also editable as well in addition to being just some text on its own right.</p>
</div>
不幸的是,当我选择要包含在我的div中的两个段落时,它们都显示为自己的块,而不是两个<p>
标记都在我的自定义<div>
中。
Paragraphs not displaying properly inside custom block style div
我尝试重置默认的回车键行为(通过enterkey额外插件),但我唯一能做的就是将回车键行为设置为换行符(<br/>
),这不是合乎需要的。
我在这个特定问题上寻求帮助,但似乎无法找到解决此问题的文章。谁能帮我?我们正在努力确定ckeditor是否足以满足我们的需求,但这对我们的内容编辑来说是一个很大的障碍。
答案 0 :(得分:2)
简短的回答是:
div
样式,因为您希望它适用于div
而不是p
,对吗?所以你应该:element: 'div'
。