Olddevs UI4.14.0

Editor

The rich text field of the Olddevs UI kit — and the API a product uses to add its own Tools and Blocks to it.

RichTextEditor from @olddevs/ui/editor is a rich text field on Tiptap: headings, lists, tables, images, code. The field's value (the Document) is stored as an HTML string. What it may contain is decided by the Schema (an allowlist of Blocks and attributes), and the Document is cleaned by it the same way in the browser and on the server. Capitalized words are Editor terms; their meanings are collected in the glossary.

What the Editor can do

These examples come from the kit's Storybook and use built-in Tools only, with no custom code: just props and Document HTML.

Bubble menu instead of a Toolbar

toolbar="bubble" removes the Toolbar above the field: a compact menu appears over selected words, as in Notion. The menu sits on an inverse surface: dark in the light theme, light in the dark one.

Tables

A header row, column alignment, merged cells and sorting live in the “Table” menu on the Toolbar: its table items are available while the caret is in a cell. Alignment is written to HTML as data-align, without style.

Code blocks

Highlighting by language, a language button in the block header and “Copy”. Highlighting arrives as a separate chunk with the first code block, and RichTextView can do it on the server.

Column layouts and Wrappers

A Column layout (layout) is one Block with columns: 50-50, 33-33-33, 60-40 and more. A Wrapper (wrapper) groups Blocks so they move, duplicate and get deleted together.

Field height

maxHeight caps the Document area: past it the Document scrolls inside the frame, while the Toolbar and the Status bar stay put. resizable adds a resize handle: a bar at the bottom edge that can also be moved from the keyboard; with it, maxHeight is the initial height rather than a cap.

Light Paper (paper)

surface="paper" shows the Document on a light Paper in any theme — for letters, templates, print and anything that leaves the app light. The interface around it stays in the app's theme.

Themes

The theme is the data-theme attribute on <html>: dark (the default), light or dim. The theme is switched for the whole app at once, and the Editor follows along with its Toolbar, code, highlights and Callout tones. The buttons below switch the theme of this whole page, and “Site theme” gives the site its own theme back.

Where to start

  • Quick start — add the kit and render your first Editor.
  • Reference — the component's props, methods and behavior. Its pages, like the extension API, come from the kit package of the version shown in the header.
  • Extension API — a custom Tool and the stability boundary.
  • Glossary — the meanings of the capitalized words.
  • TypeScript types — tables of the Editor's public types.
  • Recipes — tasks solved with the public API: Merge Tag, mentions, video, templates, an AI command, your own Toolbar, a form, server sanitization, your own brand, lazy loading. Each has a Live example.

On this page