Sitefinity 5.x: Add custom CSS class dropdown to content blo

Posted by Community Admin on 04-Aug-2018 18:43

Sitefinity 5.x: Add custom CSS class dropdown to content block editor?

All Replies

Posted by Community Admin on 11-Jan-2013 00:00

Hello, is there a way (in Sitefinity 5.x) to add dropdown list of custom CSS classes to the editor used when editing content blocks?

Tried following the instructions found at

http://www.sitefinity.com/developer-network/forums/designing-styling/custom-css-in-editor

but the following exception was thrown:

Exception Type: Telerik.Sitefinity.Web.UI.TemplateException
Message: A required control was not found in the template for "~/xxxxx/ContentEditor.ascx". The control must be assignable from type "Telerik.Sitefinity.Web.UI.CommandBar" and must have ID "editViewCommandBar".

If anyone has a clue, your help would be greatly appreciated and many thanks in advance.

Posted by Community Admin on 11-Jan-2013 00:00

Ed,

You can modify the setting in the Sitefinity admin. You'll need to go to Administration -> Settings then Text Editor. After that, click on "Edit" next to the Default tool set.

Add the Apply Class too to the editor by placing it in the XML.

<tool name="ApplyClass"/>

Next, place the reference to the CSS file and classes you'll be using in the XML. Here's an example.
<classes>
    <class name="Clear Class" value="" />
    <class name="Special Class 1" value=".sc1" />
    <class name="Special Class 2" value=".sc2" />
</classes>
<cssFiles>
    <item name="~/Sitefinity/WebsiteTemplates/TemplateName/App_Themes/Theme/Global/radStyles.css" />
</cssFiles>

NOTE: The CSS references and stuff needs to be placed outside of the <tools> nodes. Right before the </root> would be ok.

Posted by Community Admin on 11-Jan-2013 00:00

Never thought this would be under "basic settings". Excellent! Thank you!

This thread is closed