Code View Support in ASP.NET Core Rich Text Editor Control
18 Nov 20181 minute to read
The Rich Text Editor enables you to directly edit HTML code through the Source View in the text area. Any changes you make in Source view are immediately reflected in the editor’s content, giving you greater flexibility and control over your work.
The source code is presented with enhanced formatting and consistent indentation for both block-level and inline HTML elements, resulting in a cleaner, more readable, and user-friendly editing experience.
While the visual alignment of the source code is improved, the editor’s underlying value remains unchanged.
Configuring Source Code Tool in the Toolbar
You can add the SourceCode tool in the Rich Text Editor using the toolbarSettings items property.
This sample used Code mirror plugin helps to highlight the HTML content and when changes happens in code view, the same has been reflected in preview mode.
The Rich Text Editor provides the showSourceCode method, which allows you to toggle programmatically between the code view and the formatted text view. When invoked, this method switches the editor’s view to the opposite state.