How to setup the Rich Text Editor in Sitecore – The basics

Sitecore is an incredibly good platform that provides a lot of functionality out of the box, but one of the great things about Sitecore is that if there is something custom that you’d like to add in, there’s always a way to do it.

In this post I’m going to describe the main purpose of RichTextEditor and inroduce you th the ways of its extension.

 What is the Rich Text Editor in Sitecore

The Rich Text Editor is the main tool for authors in Sitecore for entering and editing the content of a website. It is the tool through which text is maintained in Rich Text fields in Sitecore templates. It can be used in both the Content Editor and the Page Editor in a popup window, but is not to be confused with the webedit field in the page editor.

rte-button-in-content-editor
Opening the Rich Text Editor from the content editor

rte-button-in-page-editor
Opening the Rich Text Editor from the Page Editor

Below you see the Rich Text Editor (RTE) with all standard functions in the ‘Full’ configuration enabled:

the-rich-text-editor-in-full-mode
The Rich Text Editor in ‘Full’ configuration

As you can see, the RTE comes with all kinds of wonderful features, such as font and style manipulation, table creation, pasting from word with (or without) script tag stripping, javascript insertion, raw HTML editing etc.

All wonderful tools for a group of well-trained and tamed content editors, who knows HTML and CSS to the bone and can’t make mistakes, ever… Well, unfortunately this does not describe the standard content editor, which more often than not, does not have HTML and CSS as main education areas. So you should very carefully think about what kind of tools you actually want to offer your content editors.

How to configure the Rich Text Editor

Configuring the RTE in Sitecore is not hard and it involves 2 steps. Setup a ‘HTML Editor Profile’ and configuring the website to use this profile.

Setup a HTML Editor Profile

Login to Sitecore and navigate to ‘/sitecore/system/Settings/Html Editor Profiles’ (be sure that you have switched to core database; database selector can help you). Here you see the different profiles that Sitecore comes with. To setup a profile, remember to copy one of the existing profiles and edit in the copy, rather than editing and possibly destroying one of the original profiles.

If you are beginner in Sitecore and don’t know how to copy something inside it just repeat the following:

  • select desire item in Sitecore
  • open ContextMenu for it (mouse right-click does it)
  • select Copying -> Copy To

When you open for example the ‘Rich Text Full’ profile, you see a list of folders that contains items that can be buttons or contain items that support som of the buttons in the editor. These are the items that you want to delete or change to limit the functionality in the editor.

Try copying the “Rich Text Full” to “Rich Text XYZ” and try deleting the ‘Toolbar 3’ folder.

html-editor-profiles1
HTML editor profiles

Configure the website to use the custom HTML Editor Profile

Open your web.config and locate the setting ‘HtmlEditor.DefaultProfile’. Change the value to the name of your custom profile.

web-config-setting
Web.config setting

Now when editing a Rich Text field, you’ll see the editor using your new profile.

no-toolbar-3
No toolbar 3

You can get quite far as to setting up the editor this way. The next couple of posts will look at restricting functions based on access righst and creating custom buttons.

Enjoy!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s