Let’s have a step by step look on how to add custom HTML Snippet to Rich Text Editor (RTE) control.
Login to Sitecore, and select core database, from the options available at the right side bottom.
Open Content Editor, and navigate to /sitecore/system/Settings/Html Editor Profiles item, where you can see the Rich Text Profiles.
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.
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.
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
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
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.
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 🙂