4

I need to provide option to Editors to select multiple styles during content formatting in RTF. Is there any out of the box option available for selecting multiple classes for any element?

In case there is no out of the box way, anyone implemented any work around and share his experience?

2 Answers 2

6

As per Jonathan, and here this is not possible.

Concatenating class names in the current control will work (I've done this as a one-off for a client) but be very clear on the limitations of scaling.

I would also be wary of templating (or per the link above XSLT'ing) changes to change the actual content as this will become confusing for the end user very quickly as when they re-edit the content the selected styles will not match those in the drop-down and you'll soon be asking them to dip into the source tab.

I would suggest that an extension of the existing functionality is really required (maybe even as an Idea) - the drop-down control simply doesn't cut it and needs to be replaced with a multi-select option.

2

I don't think that there is a way to specify more than one CSS class on a single HTML element in the rich text.

Given that these come from FormatAreaStyles.css, you could, for example add an option like class1---class2 (giving you HTML something like <p class="class1---class2">Content here</p> in your rich text source) and then transform this in your templating code (to <p class="class1 class2">Content here</p>). This could be done using 'Find and replace' or a regex.

Obviously this doesn't scale well if you're looking at adding (combinations of) lots of classes, but would work for two or three classes on a limited number of elements.

Alternatively, you could look at using something like a Custom URL (on the field name in the Component), but this could become very fiddly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.