简体   繁体   English

CKEditor多个跨度标签

[英]CKEditor multiple span tags

In ckeditor, instead of styles, I want to have classes for all styles. 在ckeditor中,我想使用所有样式的类而不是样式。 So I have used the following configuration. 因此,我使用了以下配置。

config.coreStyles_bold = {
    element: 'span',
            attributes: { 'class': 'Bold' },
};
config.coreStyles_italic = {
    element: 'span',
    attributes: { 'class': 'Italic' },
};

The Bold and Italic classes are defined in my contentsCss file. 粗体和斜体类在我的contentsCss文件中定义。

But suppose I have following text in my editor 但是假设我的编辑器中有以下文字

Sky is blue. 天空是蓝色的。

If I apply Bold and then Italic on this. 如果我在此应用Bold,然后使用斜体。 Then generated output is : 然后生成的输出是:

<span class = 'Italic'> <span class = 'Bold'> Sky is blue </span> <span>

ie two different tags for Bold and Italic are being generated. 也就是说,正在生成两个不同的Bold和Italic标签。

Whereas I would like to have the following output : 而我希望获得以下输出:

<span class= 'Bold Italic' > Sky is blue </span>

Is it possible ? 可能吗 ?
Note : I am using CKeditor 4.4.1 注意:我正在使用CKeditor 4.4.1

Maybe something like this? 也许是这样的吗?

// Only one core style for both elements
config.coreStyles_myStyle = {
element: 'span',
        attributes: { 'class': 'my-style' },
};

Then in the css 然后在CSS

.my-style{
   font-weight:bold;
   font-style:italic;
 }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM