2
votes

In ckeditor, instead of styles, I want to have classes for all styles. 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.

But suppose I have following text in my editor

Sky is blue.

If I apply Bold and then Italic on this. Then generated output is :

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

i.e. two different tags for Bold and Italic are being generated.

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

1
can you provide the file? I only see this in the minified version from ckeditor.Nick Avi
I am using a minified version of ckeditor. So what should I be doing ?user3228087
O wow that's rough, there's no real negative side to just using the two spans for this situation, it'll work the same way as one.Nick Avi

1 Answers

0
votes

Maybe something like this?

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

Then in the css

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