Skip to content

Getting Started

One engine covers three kinds of editors; the difference is only which extensions and UI components you add:

  • Classic editor - a toolbar plus a bubble menu, the familiar document-editing setup. Select the Classic tab below and pick your framework.
  • Notion-style block editor - block handles, a slash menu, drag and drop, and nested blocks. Not a separate setup: it is the classic editor plus the extensions from @domternal/extension-block-controls. Open the Notion tab below for the quickstart, go deeper with the Notion Mode guide, or build one step by step in the React tutorial.
  • Headless - just the engine, with your own UI on top. Open the Headless tab below and continue with the Editor API.
Click to try it out

The chrome around the editable area is optional and comes apart piece by piece: the toolbar, the bubble menu, and the block-insert floating menu are separate components. The quickstarts below wire up the first two; add or drop any of them independently, the editor itself does not depend on them.

Pick your framework: Vanilla for a themed editor with toolbar and bubble menu out of the box, or Angular, React, or Vue for ready-made components with auto-rendered toolbar and menus.

  1. Terminal window
    pnpm add @domternal/core @domternal/theme @domternal/vanilla
  2. import { StarterKit, BubbleMenu } from '@domternal/core';
    import {
    DomternalEditor,
    DomternalToolbar,
    DomternalBubbleMenu,
    } from '@domternal/vanilla';
    import '@domternal/theme';
    const toolbarEl = document.getElementById('toolbar')!;
    const editorEl = document.getElementById('editor')!;
    const bubbleEl = document.getElementById('bubble')!;
    const dm = new DomternalEditor(editorEl, {
    extensions: [StarterKit, BubbleMenu.configure({ element: bubbleEl })],
    content: '<p>Hello world</p>',
    });
    new DomternalToolbar(toolbarEl, { editor: dm.editor });
    new DomternalBubbleMenu(bubbleEl, { editor: dm.editor });

    StarterKit provides paragraphs, headings, lists, blockquotes, code blocks, task lists, inline formatting, keyboard shortcuts, and undo/redo. The @domternal/vanilla wrapper provides class-based components with .destroy() cleanup and EventTarget events. The @domternal/theme package adds editor styles, a toolbar layout, and 51 built-in icons via defaultIcons.

    For full control, skip StarterKit and import only the extensions you need.

Every extension in the kit can be disabled with false or configured with options:

StarterKit.configure({
codeBlock: false, // disable an extension
heading: { levels: [1, 2, 3, 4] }, // limit heading levels
history: { depth: 50 }, // configure undo stack
link: { openOnClick: false }, // keep links non-clickable while editing
linkPopover: false, // disable the built-in link popover
})

The full list of bundled extensions:

CategoryIncluded
NodesDocument, Text, Paragraph, Heading, Blockquote, CodeBlock, BulletList, OrderedList, ListItem, TaskList, TaskItem, HorizontalRule, HardBreak
MarksBold, Italic, Underline, Strike, Code, Link
BehaviorsBaseKeymap, History, Dropcursor, Gapcursor, TrailingNode, ListKeymap, LinkPopover, SelectionDecoration

Now that your editor is running, explore the rest of the toolkit:

  • StarterKit - see above for the full list of bundled extensions and how to configure them
  • Extensions - add tables, images, emoji, mentions, and syntax-highlighted code blocks via standalone packages
  • Notion Mode - turn it into a Notion-style block editor with block handles, a slash menu, and drag and drop
  • Theming - customize colors, spacing, and fonts with 160+ CSS custom properties on .dm-editor
  • Editor API - chain commands, listen to events, and read or update content programmatically
  • StackBlitz Example - a full working vanilla editor with all extensions you can edit in the browser