Skip to main content

RichText overview

DHTMLX RichText is a flexible and lightweight WYSIWYG editor built with JavaScript. Designed to provide a seamless editing experience in modern web applications, RichText offers a clean UI, rich formatting capabilities, and full control over content rendering. Whether you're building a CMS, an internal admin tool, or an embedded document editor, RichText can be easily integrated and customized to match your needs.

DHTMLX RichText component includes the following features:

RichText is framework-agnostic and can be easily integrated with React, Angular, Vue, and Svelte frameworks, making it suitable for a wide range of front-end ecosystems.

This documentation provides detailed guidance on installation, configuration, usage, and customization. You'll find examples for common scenarios, full API references, and best practices for embedding RichText into your application.

RichText structure

The RichText menubar provides access to editing actions such as creating a new document, printing, importing/exporting content, and more. It is hidden by default.

Use the menubar property to toggle its visibility. While the menubar can be enabled or disabled, its contents are not configurable at this time.

DHTMLX RichText menubar with document and file actions

Toolbar

The RichText toolbar provides quick access to text formatting and structural editing features. By default, the toolbar is enabled and displays a predefined set of commonly used controls such as bold, italic, font settings, list formatting, and more.

The toolbar property allows you to fully customize the toolbar’s content and layout. You can enable or disable toolbar, rearrange default controls, or define a fully custom toolbar using an array of predefined button identifiers and custom button objects.

DHTMLX RichText toolbar with text formatting controls

Editor

The RichText editor is the central area where users create and format content. You can control the editor’s appearance and behavior through configuration options such as value, layoutMode, and defaultStyles. RichText also supports custom styling, image embedding, and responsive layout adjustments to match the needs of your application.

Two working modes

DHTMLX RichText can work with content in "classic" and "document" modes. You can choose the most suitable mode to feel comfortable while editing text. Use the layoutMode property to switch modes programatically.

  • "classic"

DHTMLX RichText editor in classic layout mode

  • "document"

DHTMLX RichText editor in document layout mode

Supported formats

The RichText editor supports parsing and serialization of content in the HTML, plain text, and Markdown formats.

HTML format

DHTMLX RichText content serialized to HTML format

Text format

DHTMLX RichText content serialized to plain text format

Markdown format

Pass the built-in markdown encoders to setValue() / getValue() to load or serialize content as Markdown:

const editor = new richtext.Richtext("#root", {
value: "Hello world"
// other configuration properties
});

// load Markdown into the editor
editor.setValue("# Title\n\nParagraph", richtext.markdown.fromMarkdown);

// read editor content as Markdown
const md = editor.getValue(richtext.markdown.toMarkdown);
note

Markdown support covers a limited subset of the syntax — common block and inline elements such as headings, paragraphs, line breaks, emphasis, blockquotes, lists, and links. Formatting that has no Markdown equivalent (font family, font size, colors, alignment, line height) is dropped on serialization.

Nested inline structures are not supported, with the only exception of bold inside italic. Combinations such as bold inside a link, italic inside a list item, or multi-level (nested) lists will not render correctly.

Copy and paste

The RichText editor supports clipboard operations through standard system shortcuts (Ctrl+C / Ctrl+X / Ctrl+V on Windows/Linux, ⌘+C / ⌘+X / ⌘+V on macOS), the corresponding toolbar buttons, and the menubar entries.

When content is copied or cut, RichText writes two representations to the system clipboard:

  • a plain text version for compatibility with simple targets (terminals, code editors, plain inputs)
  • an HTML version that carries all inline and block formatting (bold, italic, underline, strikethrough, font family, font size, text and background color, headings, blockquotes, lists, alignment, indentation, line height, links, and images)

Paste behavior depends on the source of the clipboard payload:

  • Pasting between two RichText instances (in the same document or on different pages) uses the HTML representation and preserves the original formatting.
  • Pasting from any external source — including browsers, word processors, and other editors — is processed as plain text. The inserted content is added as text without external formatting.
note

The toolbar Paste button uses the asynchronous Clipboard API, which exposes plain text only. To paste content copied from another RichText with its formatting preserved, use the Ctrl+V / ⌘+V shortcut, which receives the full HTML payload directly from the browser's clipboard event.

Keyboard shortcuts

The RichText editor supports a set of common keyboard shortcuts for faster formatting and editing. The shortcuts follow platform conventions and are available on both Windows/Linux (Ctrl) and macOS ().

Text formatting

ActionWindows/LinuxmacOS
Bold*Ctrl+B⌘B
ItalicCtrl+I⌘I
UnderlineCtrl+U⌘U
StrikethroughCtrl+Shift+X⌘⇧X

Editing

ActionWindows/LinuxmacOS
UndoCtrl+Z⌘Z
RedoCtrl+Y / Ctrl+Shift+Z⌘Y / ⌘⇧Z
CutCtrl+X⌘X
CopyCtrl+C⌘C
PasteCtrl+V⌘V
Delete wordCtrl+Backspace / Ctrl+Delete⌥⌫ / ⌥⌦
Delete line⌘⌫ / ⌘⌦

Indentation

ActionWindows/LinuxmacOS
Indent block / nest listTab
Outdent block / lift listShift+Tab⇧⇥

Special actions

ActionWindows/LinuxmacOS
Insert linkCtrl+K⌘K
PrintCtrl+P⌘P
info

More shortcuts may be introduced in future updates.

To get actual reference related to RichText keyboard shortcuts, press Help and select the Keyboard shortcuts option:

DHTMLX RichText keyboard shortcuts reference window