Remove Formatting in the ASP.NET MVC Rich Text Editor Component
18 Nov 20181 minute to read
The ASP.NET Core Rich Text Editor component offers a powerful Clear Format feature to remove any applied formatting from selected text.
This feature is particularly useful when you need to:
- Remove multiple styles at once
- Quickly standardize text formatting
- Prepare text for new styling
Configuring Clear Format
To enable the Clear Format feature in your Rich Text Editor, you need to add it to the toolbar items. Follow these steps:
- Open your component file where you’ve implemented the Rich Text Editor.
- Locate the ToolbarSettings property in your Rich Text Editor configuration.
- Add
'ClearFormat'to theItemsarray withinToolbarSettings.
Here’s an example of how to configure the Clear Format feature:
Using Clear Format
Once configured, you can use the Clear Format feature as follows:
- Select the text with formatting you want to remove.
- Click the
Clear Formatbutton in the toolbar. - The selected text will revert to its original, unformatted state.
Using Clear Format makes it easy to undo styling changes and keep your text looking consistent. Examples and code snippets below show how to use ‘Clear Format’ effectively in the Rich Text Editor.