Go Back

Enabling/Disabling Tools in RadEditor

Sitefinity ASP.NET CMS is a web-based content management platform and Telerik's RadEditor plays a key role in managing the web site's content.  RadEditor is a WYSIWYG web-based editor that makes it easy to create rich-text content. 

In a nutshell, RadEditor empowers editors to create HTML without knowing HTML.

RadEditor in Sitefinity Example

RadEditor is part of the Telerik's RadControls for AJAX UI suite.  Sitefinity comes included with this entire suite of UI products.  All of these controls are available to use within your Sitefinity project.

Tools, Tools and more Tools

RadEditor alone is a very powerful product and has many tools available.  Out of the box, only a fraction of these tools are enabled in Sitefinity.  There are over 60 tools that can be easily added to RadEditor (full list of RadEditor tools). 

In fact, if all the tools are enabled, it becomes overwhelming....

RadEditor with All Tools Enabled

Enabling ALL tools might be unpractical, however you might discover a handful of tools that would be very useful for your web site.

Adding New Tools to RadEditor in Sitefinity

There is an XML configuration file that controls what tools are available in RadEditor and how these tools are visually displayed.  For Sitefinity's, this RadEditor configuration file can be found at:

~/Sitefinity/Admin/ControlTemplates/EditorToolsFile.xml

In this XML file you'll see several <tools> sections that look like this:

  <tools dockable="false">
    <tool name="Bold" shortcut="CTRL+B"/>
    <tool name="Italic" shortcut="CTRL+I"/>
    <tool name="JustifyLeft" />
    <tool name="JustifyCenter" />
    <tool name="JustifyRight" />
    <tool name="JustifyFull" />
    <tool name="InsertOrderedList" />
    <tool name="InsertUnorderedList" />
    <tool separator="true"/>
  </tools>

Adding a new tool simply requires a new <tool> element.  This <tool> element can be added to an existing <tools> section or you can create a new <tools> section.  The <tool> name will need to match the name of an existing RadEditor tool.

The organization of the <tools> and <tool> elements can be changed however you wish.  The ordering and grouping of these elements will control how these tools are visually displayed.

Below is a <tools> section that enables font size, font color and background color to be set:

  <tools dockable="false">
    <tool name="FontSize" />
    <tool name="ForeColor" />
    <tool name="BackColor" />
    <tool separator="true"/>
  </tools>

This will add 3 new tools to RadEditor:

RadEditor in Sitefinity with Font Tools Enabled

Incoming Rant!!!!  Just for the record, I think allowing editors to arbitrarily use whatever font, font size, font color and background color they want is a bad idea.  Not only does this generate a lot of extra HTML (embedded styles), but you'll lose presentation consistency on your web site.  In addition, it's impossible to re-design your web site later if its littered with embedded font styles. 

Instead, I'm a much bigger fan of pre-defined styles that editors can select from.  Many big companies have usage guidelines for logos & various marketing material.  These guidelines specify the font, the spacing and contain strict usage rules.  This might seem overly bureaucratic, but strong brand recognition doesn't come naturally.  I recommend that you work with the marketing department to create guidelines and then enforce these guidelines through Sitefinity & RadEditor.  (More about this in later blog posts.)

This being said, in past jobs I was forced to let go of this due to popular demand.  Then, one day, I would load the web site and think "Oh great, there is now a dancing cowboy GIF on main page...yeah that's really cute.  I'm sure this will be the thing that convinces our online customers to make a purchase."   *sigh*

Bitter?  Me?  Nah...   :)

Comments  6

  • Bo Godthaab 15 Mar

    Thanks for yet another article concerning the RadEditor. I particularly agree that we must verify users to choose their own fonts, sizes, etc. So I was curious to learn how to change the default stylesheet in Radeditor, but no ;-( . In your excellent webinar "Making the most of Sitefinity in RadEditor" showed you how to insert a custom stylesheet in the file: ~/Sitefinity/Admin/ControlTemplates/Generic_Content/EditorTemplate.ascx. In Sitefinity 3.6, this file no longer exists. How do I change stylesheet?. I am very surprised why such a significant detail not described by Sitefinity. My customers would shout after me, if they do not get WYSIWYG. Another thing, it's a known bug that you can not run in full screen size? An ordinary user's primary tool is the editor. Therefore it must be 100%, otherwise the buyers disappear ... We are brand new in Sitefinity (sales & support) and I know that it will be hard for our support-team, if the editor sucks.
  • Marko 16 Mar

    Thanks for a good write-up, as always! I also agree with your font type/size comments. Another issue is with the use of headings (h1, h2,...h6) vs. paragraphs, when it comes to preserving site accessibility. People who use screen readers usually say that correct heading structure is the key in having an accessible and easily-navigable page. But left to the average user who doesn't know (or care about) this and only takes the h1-h6 to be different options for font-sizes in a rich-text editor such as RadEditor, you can quickly end up with messy and accessibility-incompliant HTML. Not-to mention the table-happy users who still think that if you want to indent text from the left, all you need to do is insert some nested tables (yikes!). All-in-all, RadEditor does a pretty good job of streamlining things for the average user, though, in my opinion.
  • almny 09 Jun

    thanks man
    you solved me problem about Adding New Tools to RadEditor in Sitefinity
  • snail 26 Jun

    Thanks!! You are such a great man!!!!
  • Mike Sharp 14 Apr

    Bo Godthaab:  You can add the following snippet to your EditorToolsFile.xml, and it will use the stylesheet you specify.

    <cssFiles>
      <item name="~/Styles/radeditor.css" />
    </cssFiles>

    However, as a note to Gabe, the EditorToolsFile.xml doesn't seem to be parsed when you open the RadEditor by decorating a public property like:

    public partial class UserControls_Widgets_HomeContent : System.Web.UI.UserControl
    {
        [Telerik.Cms.Web.UI.WebEditor("SomeNamespace.RichTextEditor, App_Code")]
        public string RichText
        {
            get
            {
                return this._richText;
            }
            set
            {
                this._richText = value;
            }
        }
      
        private string _richText;



  • rhodmie sagum 05 May

    hi guys,

    we are implementing a custom RadEditor in our site, i just wanna ask if there is a way to disable 'BackColor' tool from code behind e.g. CustomRadEditor,aspx.cs? can you guys post the code snippets thanks in advance
Post a comment!
  1. Formatting options
       
     
     
     
     
       
  2. I'm sorry for the CAPTCHA. You have spammers to thank for this: