如何在CKEditor中添加自定义段落格式 [英] How to add a custom paragraph format in CKEditor
本文介绍了如何在CKEditor中添加自定义段落格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
使用 CKEDITOR.config.formatTags 指定一些新格式:
CKEDITOR.replace('editor1',{
format_tags:'p; h2; h3; pre; links',//条目以段落格式显示
format_links:{
name:'Links',
element:'span',
styles:{
color:'red',
'font-family' :'arial',
'font-weight':'bold'
}
}
});
要了解更多关于样式,请参阅 CKEDITOR.styleSet 的作品。另请注意,由于CKEditor 4.1,从段落格式中删除样式对高级内容过滤器。
In my project I have a requirement to remove the paragraph format like "Address" and "Formatted" from the drop down and to add a new custom format called "Links" which would be Arial, 14px, bold, red. Is it possible to add custom paragraph format in CKEditor?
解决方案
Use CKEDITOR.config.formatTags to specify some new formatting:
CKEDITOR.replace( 'editor1', {
format_tags: 'p;h2;h3;pre;links', // entries is displayed in "Paragraph format"
format_links: {
name: 'Links',
element: 'span',
styles: {
color: 'red',
'font-family': 'arial',
'font-weight': 'bold'
}
}
} );
To know more about styles see how CKEDITOR.styleSet works. Also note that since CKEditor 4.1, removing styles from "Paragraph format" has an impact on Advanced Content Filter.
这篇关于如何在CKEditor中添加自定义段落格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文