Your search did not match any results.
Html Editor

Toolbar Customization

Documentation

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.

@section ExternalDependencies { <script src="https://cdnjs.cloudflare.com/ajax/libs/quill/1.3.7/quill.min.js"></script> } @(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(HtmlEditorToolbarItem.Undo); items.Add().FormatName(HtmlEditorToolbarItem.Redo); items.Add().FormatName(HtmlEditorToolbarItem.Separator); items.Add() .FormatName("header") .FormatValues(new JS("[false, 1, 2, 3, 4, 5]")); items.Add().FormatName(HtmlEditorToolbarItem.Separator); items.Add().FormatName(HtmlEditorToolbarItem.Bold); items.Add().FormatName(HtmlEditorToolbarItem.Italic); items.Add().FormatName(HtmlEditorToolbarItem.Strike); items.Add().FormatName(HtmlEditorToolbarItem.Underline); items.Add().FormatName(HtmlEditorToolbarItem.Separator); items.Add().FormatName(HtmlEditorToolbarItem.AlignLeft); items.Add().FormatName(HtmlEditorToolbarItem.AlignCenter); items.Add().FormatName(HtmlEditorToolbarItem.AlignRight); items.Add().FormatName(HtmlEditorToolbarItem.AlignJustify); items.Add().FormatName(HtmlEditorToolbarItem.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>
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; }