WEBcoast Logo

CKEditor 4: Style set with multiple classes not showing

I ran into a problem recently, where I wanted to add a style set, that adds multiple classes. In my case it was for a link (button), that should have the classes button button--primary button--big. But every time I added the button--big, the style set disappeared.

After debugging the CKEditor code I found out, that when rendering the style sets, the classes are exploded, sorted and concatenated again. This is compared to the original class list. If this does not match, the style set was not added to the list.

The solution is simple though. You need to add the classes in alphabetical order. In my case button button--big button--primary.