{ name: 'Small Block Right', element: 'p', attributes: { 'class': 'u-float-right u-block-sm' } }
I'm setting up the configuration for the Styles drop-down in my CKEditor, and am wondering if it is possible to apply multiple classes to a single element with a single style. The section of my stylesSet definition looks like this (note: this is a snippet and not the complete stylesSet definition):
{ name: 'Small Block Right', element: 'p', attributes: { 'class': 'u-float-right u-block-sm' } }I've put both class names in the single class attribute as shown based on a post I found in a general CKEditor discussion elsewhere, which implies this "should just work". However, when I try to use this in my Hippo configuration, the style Small Block Right does not appear in the Styles drop-down. I have a number of other styles defined in the same stylesSet that do appear, and if I remove one of the class names from the above snippet, it does appear. So the problem does not seem to be with the stylesSet definition as a whole, only when attempting to apply multiple classes.
Is there some other way that I should be defining multiple classes to be applied, or another setting I need to configure as well? Or does the version of CKEditor used in Hippo 10 not support applying multiple classes?
--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
To post to this group, send email to hippo-c...@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.
Visit this group at http://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.
(function () {
"use strict";
CKEDITOR.stylesSet.add('mystyles', [
{
name: 'Small Block Right',
element: 'p',
attributes: {
'class': 'u-float-right u-block-sm'
}
}
]);
}());
(function () {
"use strict";
CKEDITOR.stylesSet.add('mystyles', [
{
name: 'Small Block Right',
element: 'p',
attributes: {
'class': 'u-float-right'
}
}
]);
}());
(function () {
"use strict";
CKEDITOR.stylesSet.add('mystyles', [
{
name: 'Small Block Right',
element: 'p',
attributes: {
'class': 'u-float-right u-block-sm'
}
}
]);
}());
(function () {
"use strict";
CKEDITOR.stylesSet.add('mystyles', [
{
name: 'Small Block Right',
element: 'p',
attributes: {
'class': 'u-block-sm u-float-right'
}
}
]);
}());
--
{ name: 'light', element: 'h1', attributes: { 'class': 'light' } },
{ name: 'light accent', element: 'h1', attributes: { 'class': 'light accent' } }
{ name: 'light', element: 'h1', attributes: { 'class': 'light' } },
{ name: 'light accent', element: 'h1', attributes: { 'class': 'accent light' } }
{ name: 'Box Info', element: 'p', attributes: { 'class': 'msg info' } },
{ name: 'Box Notice', element: 'p', attributes: { 'class': 'msg notice' } },
{ name: 'Box Error', element: 'p', attributes: { 'class': 'msg error' } },
{ name: 'Box Success', element: 'p', attributes: { 'class': 'msg success' } },
Sorry if I'm sort-of-hijacking this, but I'm using a CKEditor instance in another product (an addon with the CMS redaxo actually) where I met a very similar issue.My findings were the following:
- If you define a custom styleSet with a single class -> no problem
- ...a double class definition: there are several outcomes:
- a) your definition shows up in ckeditor correctly and can be used
- b) it won't show based on how the two classes are named
Our problem with our current project were dialogue boxes with different kind of styling (info, notice, error, success). All boxes were "p" tags with class "msg" and another class for the specific styling. The outcome with adding those to CKeditor were quite surprising. We added it like this:
{ name: 'Box Info', element: 'p', attributes: { 'class': 'msg info' } },
{ name: 'Box Notice', element: 'p', attributes: { 'class': 'msg notice' } },
{ name: 'Box Error', element: 'p', attributes: { 'class': 'msg error' } },
{ name: 'Box Success', element: 'p', attributes: { 'class': 'msg success' } },The outcome was surprising: "info" and "error" wouldn't show up. But "notice" and "success" were visible. I played around a bit and broke it down to the combination of class names. If you replace "msg" with "abc" - it works. If you use "xyz" it won't. Also using "text" with any other class behind it, won't show up whatever you do, but if you only use the single class "text", it works. So it seems, CKEditor has some strange problem when combinations of classes come together.Perhaps any of you got to the bottom of this or is this still an open bug(?)