Olddevs UI4.14.0
Reference

3.37.0 — An Editor open to extension

Status: behavior change — a minor under the "Stability" section of the Editor extension API: the saved HTML, onChange, onUploadImage and focus() do not change, and the previous code builds. The note is needed because five changes are visible to current consumers of @olddevs/ui/editor, and one requires installing packages with pnpm. The new API (a custom Tool, the Handle, events, the Status bar) requires no action — it is on the extension API page.

1. Two new peer packages

The blockquote and the horizontal rule take their Extensions from @tiptap/extension-blockquote and @tiptap/extension-horizontal-rule — optional peer dependencies of the @olddevs/ui/editor entry point with the same ^3.31.4 range (since 3.46.0 the engine packages are no longer in the kit manifest; see the entry above).

Who is affected. Only pnpm (strict node_modules) and installs with --omit=optional: npm and yarn install both packages as dependencies of @tiptap/starter-kit, and the import resolves.

Action before updating.

pnpm add @tiptap/extension-blockquote @tiptap/extension-horizontal-rule

The full command is on the RichTextEditor page.

2. A horizontal rule no longer counts as a character in maxLength

What changed. Before, the counter substituted a space for a leaf node, and every <hr> took one character from the limit. Now an Atom counts as the length of its Atom text (renderText): a horizontal rule counts as 0, a hard break as 1, an image as the length of its caption. The counter matches getText() without Block separators.

Who is affected. Screens with maxLength and horizontal rules in the Document. A Document with N horizontal rules fits N more characters, and a Document that was previously "over the limit" by the number of horizontal rules now fits. If the server checks length against the same limit and counts <hr> as a character, it will reject what the Editor let through.

Before → after.

DocumentBeforeAfter
<p>abc</p><hr><p>de</p>6 characters5 characters
<p>a<br>b</p>33

A paste past the limit cuts the tail by characters, not by positions; an Atom that did not fit goes away whole, together with everything after it.

Action before updating. Check the server-side length validation against the kit's rule: the Document's text without markup and Block separators, an Atom by the length of its text. The kit has no server-side counter: the count of a custom Atom depends on its Extensions.

3. Skeleton before Readiness

What changed. Before Readiness, the Editor shows a Skeleton: the field frame, the place of the Toolbar and the Document sanitized by the Schema, as static HTML with no input. Before, this place was an empty area; now the field height does not jump. On the server and before hydration, the Skeleton is only the frame, and the Document appears after mounting in the browser. In full, the code block and the table now arrive as a separate chunk, so Readiness comes after they load, and the Skeleton is visible until then (in it, the code block is shown with its header and the table with its cells). The basic Preset does not load these chunks and is ready at once. The "start" scenario (the static graph of the subpath with the engine, what basic pays) got lighter: 312.3 → 286.6 kB gzip. The "full" scenario (with all lazy chunks, full) weighs 327.7 kB (measured at 3.37.0; the current table is in "Import size").

Who is affected.

  • Code that accesses ref.current.editor or calls ref.current.focus(), insertHTML() right after mounting: in full the engine appears later, and before Readiness editor is null and the Handle's methods do nothing and do not throw.
  • Consumer tests with full that look for role="textbox" synchronously right after render: the editable area appears after the chunks load. The Skeleton has no textbox role.
  • Visual snapshots of pages with the Editor: in place of the empty area there is the frame and the Document.

Before → after.

// before — focus in the mount effect: in `full` the engine is not there yet, the call does nothing
useEffect(() => ref.current?.focus(), []);

// after — the callback reports the moment of Readiness
<RichTextEditor ref={ref} onReady={() => ref.current?.focus()} />;
// test: wait for the editable area, do not grab it synchronously
expect(await screen.findByRole("textbox")).toBeInTheDocument();

Action before updating. Find the uses of ref.current.editor and the Handle's methods in mount effects and move them to onReady; in tests, replace getByRole("textbox") for an Editor with full with await findByRole. To have the chunks arrive with the page, add modulepreload for them (recipe).

4. Image messages go through the Field notice channel

What changed. "Uploading…", "uploaded", an upload refusal, "not an image" and "files are not accepted" go through the same channel as the new engine command showNotice: one place under the field, a new message replaces the previous one, and an error (role="alert") stays until the next User edit. The texts and roles are the same, but the live region role="status" is now present in every Editor, not only with the image Tool.

Who is affected. Tests that checked for the absence of role="status" in an Editor without image or counted live regions on the page, and screens that rendered their own paste error line next to the field.

Action before updating. Look for the region by the message text, not merely by whether it is present. Replace your own paste and upload error line with the command ref.current?.editor?.commands.showNotice({ tone: "error", text }): otherwise the error would be announced twice.

5. The Tool type accepts descriptions of custom Tools

What changed. The Tool type (a tools element) is now ToolName | CustomTool; the name of a built-in Tool is the new type ToolName. The previous Tool was a string name.

Who is affected. TypeScript code that treated Tool as a string: tool.startsWith(…), the keys of Record<Tool, …>, comparison in a switch.

Before → after.

// before
import type { Tool } from "@olddevs/ui/editor";
const labels: Record<Tool, string> = { … };

// after
import type { ToolName } from "@olddevs/ui/editor";
const labels: Record<ToolName, string> = { … };

Action before updating. tsc will find such places on its own; replace Tool with ToolName in them. Arrays of names for tools do not need to change.

What else is visible — no action needed

  • "Unwrap" in the Block handle menu sits in a separate Tool section before "Delete": custom Block actions go to the same place.
  • New strings in the editor namespace of the message catalog: toolsFailed, retry, calloutShown. If you pass your own full message catalog, add them; a partial catalog takes the kit's fallback.

On this page