Documentation

About Yurich

Yurich is a React rich text editor for posts, comments, and forms. Decide what people can format, build the toolbar in your app, and save the result as HTML.

Build the toolbar your screen needs

In a React 18+ app, run npm install yurich. Yurich uses the react and react-dom packages already installed in your project. It brings in zero extra runtime libraries.

For a comment box, start with bold and links. Register Bold and Link and connect them to your buttons. Yurich supplies the editing behavior, while your app supplies the controls and styles. Try the bold button

What happens to the text you edit?

Save the same HTML you edit

The editable area is a browser element with contentEditable. The browser edits its HTML directly, and Yurich reads the highlighted text through the Selection API to apply formatting. This editable HTML is the document. getHTML() reads it when you submit the form. There is no second model to keep in sync, and formatting commands work directly on the DOM, without document.execCommand. Try saving HTML

Choose what survives a paste

Enabled extensions define the permitted HTML. With only Bold enabled, a pasted heading becomes a paragraph and bold text stays bold. The same rules apply when loading a draft and when exporting HTML with sanitization enabled. Try pasting formatted text

Support keyboards and text composition

The editor exposes an accessible multiline textbox and runs extension keyboard shortcuts. Use ariaLabel to name the field and aria-pressed on toolbar toggles. During Japanese, Korean, Chinese, or other IME composition, Yurich waits for composition to finish before cleaning up the edited block. See IME behavior

What the bold button does

Register Bold to enable toggleBold and allow <strong> in the document.

  1. React app The toolbar calls toggleBold.
  2. Yurich core The command reads the selection and applies the formatting.
  3. Editable HTML The selected text is wrapped in <strong>.
Before
<p>Hello Yurich</p>
After
<p>Hello <strong>Yurich</strong></p>

Yurich records the edit and selection in history. A toolbar button can use useIsActive to tell whether the selection is bold.

Two ways to use it

Article form

Register Bold and Link for the article body. Call getHTML() on submit and send it with the other fields to your API. Try the form example.

Internal publishing tool

If editors need a callout, declare an aside block with block(). Connect its command to a toolbar button so the callout survives when the document is saved and reopened. Build a custom extension.

Where it fits

Yurich works in browser-based forms, comment editors, and publishing tools with a custom interface. Editing needs a mounted DOM. Your app handles storage and synchronization.

Browse the API