More in this section

Forums / Developing with Sitefinity / Sitefinity 5.x: Add custom CSS class dropdown to content block editor?

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

3 posts, 1 answered
  1. Ed
    Ed avatar
    4 posts
    Registered:
    19 Jul 2012
    11 Jan 2013
    Link to this post

    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.

  2. Tim
    Tim avatar
    258 posts
    Registered:
    22 Jun 2011
    11 Jan 2013 in reply to Ed
    Link to this post
    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.
    Answered
  3. Ed
    Ed avatar
    4 posts
    Registered:
    19 Jul 2012
    11 Jan 2013 in reply to Tim
    Link to this post
    Never thought this would be under "basic settings". Excellent! Thank you!
3 posts, 1 answered