Sunday, 29 November 2020

Adding Custom CSS classes in Rich text Editor under "Apply CSS Classes" Dropdown.

In My Previous Blog I Tried to show how we can create a Custom Rich Text editor Profile, which is at times required to restrict Content editor to play with content.

In This Blog Let's explore another feature in Rich Text editor, which is How can we apply custom CSS in Rich Text Editor.

Adding custom CSS in Rich Text Editor is a Three Step Process.

1. Create a Custom CSS file which will have your custom CSS that we want to apply in Rich Text Editor.

For our reference I have created CustomRichTextCSS.css file with some random Classes.

2. Place this newly created CustomRichTextCSS.css file in our Publish Folder.

3. Now We need to let Sitecore know about this newly created CSS file by adding a reference of CustomRichTextCSS.css file in Sitecore.Config.



For the demo purpose I have added CustomRichTextCSS.css file directly in Sitecore.Config, But as a Sitecore best practice we should avoid making any direct changes  in Sitecore.Config. Instead create a config patch and add reference of the file as shown below.






Now the changes can be viewed from the field in Rich Text editor named "Apply CSS Classes"

"Apply CSS Classes" Field is by default available in  Rich Text Editor Full profile

Rich Text Full:- /sitecore/system/Settings/Html Editor Profiles/Rich Text Full.

Hope That Helps... Happy Learning 😊😊😊

1 comment:

Related Blogs

Adding Custom CSS classes in Rich text Editor under "Apply CSS Classes" Dropdown.

In My Previous Blog I Tried to show how we can create a Custom Rich Text editor Profile, which is at times required to restrict Content edit...