如何在ckeditor中对一个元素应用多种样式?

How to apply multiple styles to one element in ckeditor?

我想将一些 bootstrap 类 整合到我的 ckeditor 配置文件中:

{ name : 'Button Large' , element : 'a', attributes : { 'class' : 'btn-lg' } },
{ name : 'Button Primary' , element : 'a', attributes : { 'class' : 'btn-primary' } },

但问题是这些样式无法组合。如果我想要一个 btn-primarybtn-lg 的按钮,我将不得不创建第三种样式:

{ name : 'Button Large Primary' , element : 'a', attributes : { 'class' : 'btn-lg btn-primary' } },

这对于许多按钮来说显然是多余的,没有必要。那你怎么能做到这一点?

使用 CKeditor 4.4.3

CKEditor 目前不支持在同一元素的下拉菜单中设置两种样式。在他们的跟踪器中查看 this or this 票。

如果在源视图中添加 类 不是一个选项,您可能必须编写自己的插件(如 this SO user is doing for colors.