Let’s have a step by step look on how to add custom HTML Snippet to Rich Text Editor (RTE) control.
Step 1:
Login to Sitecore, and select core database, from the options available at the right side bottom.
Step 2:
Open Content Editor, and navigate to /sitecore/system/Settings/Html Editor Profiles item, where you can see the Rich Text Profiles.
Step 3:
Open the Rich Text Full, and navigate to /sitecore/system/Settings/Html Editor Profiles/Rich Text Full/Snippets item, under which we add custom HTML snippets.
Step 4:
Under Snippets, create a new Snippet, by using the /sitecore/templates/System/Html Editor Profiles/Html Editor Snippet template, which contains Header and Value fields.
Step 5:
Fill the Header and Value fields, Header field holds the title to be displayed in Rich Text Editor, and Value field holds the actual HTML block elements.
I have added an Image as well.
as this is core database, no need to publish the changes
Step 6:
This completes the work on Core database, let’s switch back to Master database. Create a template with Rich Text field, and have source field point to the Rich Text Profile, for which you have added HTML snippet.
To enable all the Rich fields to use this control, make change in the configuration to HtmlEditor.DefaultProfile
Step 7:
Navigate to the content item, and open the Rich Text Editor, click on the Insert Code Snippetoption and select the
Custom HTML Block, which inserts the HTML.
Step 8:
Once the HTML block is added, content authors have flexibility to modify it, event Image can also be modified, by selecting the Image, and right click to get the options.
Happy Learning 🙂