Your search did not match any results.
Html Editor

Toolbar Customization


This demo shows how to add a custom control to the toolbar. The Show markup button opens a popup that displays the HtmlEditor’s output markup.

@(Html.DevExtreme().HtmlEditor() .ID("html_editor") .Content(@<text> <h2> <img src="../../Content/images/widgets/HtmlEditor.svg" alt="HtmlEditor" /> Formatted Text Editor (HTML Editor) </h2> <br> <p> DevExtreme HTML5 JavaScript HTML Editor is a client-side WYSIWYG text editor that allows its users to format textual and visual content and store it as HTML or Markdown. </p> <p>Supported features:</p> <ul> <li> Inline formats: <ul> <li><strong>Bold</strong>, <em>italic</em>, <s>underlined</s> text formatting</li> <li>Font, size, color changes (HTML only)</li> </ul> </li> <li> Block formats: <ul> <li>Headers</li> <li>Text alignment</li> <li>Lists (ordered and unordered)</li> <li>Code blocks</li> <li>Quotes</li> </ul> </li> <li>Custom formats</li> <li>HTML and Markdown support</li> <li>Mail-merge placeholders (for example, %username%)</li> <li>Adaptive toolbar for working images, links, and color formats</li> <li>Insert images as a link or base64 (drag-and-drop images to convert them to base64)</li> <li>Copy-paste rich content (unsupported formats are removed)</li> </ul> </text>) .Toolbar(toolbar => toolbar.Items( items => { items.Add().FormatName("undo"); items.Add().FormatName("redo"); items.Add().FormatName("separator"); items.Add() .FormatName("header") .FormatValues(new JS("[false, 1, 2, 3, 4, 5]")); items.Add().FormatName("separator"); items.Add().FormatName("bold"); items.Add().FormatName("italic"); items.Add().FormatName("strike"); items.Add().FormatName("underline"); items.Add().FormatName("separator"); items.Add().FormatName("alignLeft"); items.Add().FormatName("alignCenter"); items.Add().FormatName("alignRight"); items.Add().FormatName("alignJustify"); items.Add().FormatName("separator"); items.Add() .Widget(widget => widget.Button() .Text("Show markup") .StylingMode(ButtonStylingMode.Text) .OnClick("showMarkup") ); }) ) ) @(Html.DevExtreme().Popup() .ID("popup") .ShowTitle(true) .Title("Markup") .OnShowing("popupShowing") .Content(@<text> <div class="value-content"></div> </text>) ) <script> function showMarkup() { var popupInstance = $("#popup").dxPopup("instance"); popupInstance.toggle(!popupInstance.option("visible")); } function popupShowing() { var editorInstance = $("#html_editor").dxHtmlEditor("instance"); $(".value-content").text(editorInstance.option("value")); } </script> <script src=""></script>
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Web.Mvc; using DevExtreme.MVC.Demos.Models.SampleData; namespace DevExtreme.MVC.Demos.Controllers { public class HtmlEditorController : Controller { public ActionResult ToolbarCustomization() { return View(); } } }
.dx-htmleditor-content img { vertical-align: middle; padding-right: 10px; }