Editor mode in ASP.NET MVC Rich text editor control

4 Mar 20253 minutes to read

The Rich Text Editor control used to create, edit and return the content in valid HTML markup or markdown (MD) of the content. It supports following two editing formation.

  • HTML Editor
  • Markdown Editor

HTML Editor

Rich Text Editor is a WYSIWYG editing control for formatting the word content as HTML.

The HTML editing mode is the default mode of Rich Text Editor. Which is used for format the content through the available toolbar items and returns the valid HTML markup. Set the EditorMode property as HTML.

@Html.EJS().RichTextEditor("htmlEditor").Value(ViewBag.value).Render()
public class HomeController : Controller
{
    public ActionResult Index()
    {
        ViewBag.value = @"<p>The Syncfudion Rich Text Editor, a WYSIWYG (what you see is what you get) editor, is a user interface that allows you to create, edit, and format rich text content. You can try out a demo of this editor here.</p><p><b>Key features:</b></p><ul><li><p>Provides &lt;IFRAME&gt; and &lt;DIV&gt; modes.</p></li><li><p>Bulleted and numbered lists.</p></li><li><p>Handles images, hyperlinks, videos, hyperlinks, uploads, etc.</p></li><li><p>Contains undo/redo manager. </p></li></ul><div style='display: inline-block; width: 60%; vertical-align: top; cursor: auto;'><img alt='Sky with sun' src='https://cdn.syncfusion.com/ej2/richtexteditor-resources/RTE-Overview.png' width='309' style='min-width: 10px; min-height: 10px; width: 309px; height: 174px;' class='e-rte-image e-imginline e-rte-drag-image' height='174' /></div>";
        return View();
    }
}

Markdown Editor

Set the EditorMode property value as Markdown to create or edit the content and apply formatting to view markdown formatted content.

The third-party library such as Marked or any other library is used to convert markdown into HTML content.

  • The Supported Tags are h6,h5,h4,h3,h2,h1,blockquote,pre,p,ol,ul.
  • The Supported Selection Tags are Bold, Italic, StrikeThrough, InlineCode, SubScript, SuperScript, UpperCase, LowerCase.
  • The supported insert commands are Image, Link and Table.
@using Syncfusion.EJ2.RichTextEditor

@Html.EJS().RichTextEditor("markdown").Value((string)ViewBag.value).EditorMode(EditorMode.Markdown).Render()
public class HomeController : Controller
{
    public ActionResult Index()
    {
        ViewBag.value = @"***Overview***
  The Rich Text Editor control is WYSIWYG ('what you see is what you get') editor used to create and edit the content and return valid HTML markup or markdown (MD) of the content. The editor provides a standard toolbar to format content using its commands. Modular library features to load the necessary functionality on demand. The toolbar contains commands to align the text, insert link, insert image, insert list, undo/redo operation, HTML view, and more.

  ***Key features***
  - *Mode*: Provides IFRAME and DIV mode.
  - *Module*: Modular library to load the necessary functionality on demand.
  - *Toolbar*: Provide a fully customizable toolbar.
  - *Editing*: HTML view to edit the source directly for developers.
  - *Third-party Integration*: Supports to integrate third-party library.
  - *Preview*: Preview the modified content before saving it.
  - *Tools*: Handling images, hyperlinks, video, uploads and more.
  - *Undo and Redo*: Undo/redo manager.
  - *Lists*:Creates bulleted and numbered list.";
        return View();
    }
}

For further details on Markdown editing, refer to the Markdown

See Also