Skip to content

docs(custom-ui): cover the controller surface shipped in SD-2936 stack#3173

Merged
caio-pizzol merged 3 commits intomainfrom
caio/docs-custom-ui-coverage
May 5, 2026
Merged

docs(custom-ui): cover the controller surface shipped in SD-2936 stack#3173
caio-pizzol merged 3 commits intomainfrom
caio/docs-custom-ui-coverage

Conversation

@caio-pizzol
Copy link
Copy Markdown
Contributor

Brings the public Custom UI docs up to parity with what's actually shipped on `superdoc/ui` after the SD-2936 stack (SD-2943, SD-2954, SD-2945, SD-2944). Net: nine pages updated, one new page, one consumer-facing AGENTS.md section, ~580 lines of new docs.

The biggest gap was the right-click context bundle. A reader who landed on the docs trying to build a custom right-click menu found the deprecated `built-in-ui/context-menu.mdx` (which incorrectly described `disableContextMenu` as suppressing all menus) and nothing about `ui.viewport.contextAt`, `getContextMenuItems`, `ContextMenuItem.invoke()`, or the `context` parameter in `execute`. New `editor/custom-ui/context-menu.mdx` walks the full flow end-to-end with predicate examples for the three subjects (entity, selection, click point) and a worked example mirroring `demos/custom-ui`.

Other notable gaps closed: `ui.selection.restore` was marked "planned" but shipped in SD-2929 / fixed in SD-2954; `ui.selection.getRects` / `getAnchorRect` (the floating bubble menu pattern) were undocumented; `ui.viewport.entityAt` / `getHost` / `positionAt` were undocumented; the `shortcut` field on `register` was undocumented; `execute` examples showed the pre-SD-2945 signature without `context`; `disableContextMenu` was misrepresented; theming had no cross-link from comments / track-changes.

Verified: `pnpm run check:imports` (642 files), `pnpm run check:icons` (Lucide), `pnpm run test:examples` -> 291 passed (+14 new doctests).

Brings the Custom UI docs up to parity with what's shipped on
superdoc/ui (SD-2943, SD-2954, SD-2945, SD-2944).

- New editor/custom-ui/context-menu.mdx walks the right-click flow:
  disableContextMenu, contextAt({ x, y }), getContextMenuItems(context),
  invoke(), predicate examples for entity/selection/click-point.
- selection-and-viewport.mdx expanded for seven previously
  undocumented methods: ui.selection.restore (with reason table),
  getRects, getAnchorRect, ui.viewport.getHost, entityAt, positionAt,
  contextAt.
- custom-commands.mdx: execute now { payload, superdoc, editor, context };
  shortcut, contextMenu contribution, commands.has, commands.require
  documented.
- api-reference.mdx: new methods + ContextMenuContribution,
  ContextMenuWhenInput, ContextMenuItem with invoke,
  SelectionAnchorRectOptions, SelectionRestoreResult, ViewportEntityHit,
  ViewportPositionHit, ViewportContext.
- overview.mdx: Card for context-menu plus three-surfaces recipe.
- Built-in context-menu page corrects disableContextMenu semantics and
  points to the new custom-ui flow.
- navigation.mdx reframed around ui.comments.scrollTo /
  trackChanges.scrollTo / viewport.scrollIntoView at the top.
- comments and track-changes cross-link to theming.
- packages/superdoc/AGENTS.md gains a Custom UI (React) section.
@caio-pizzol caio-pizzol requested a review from a team as a code owner May 5, 2026 20:39
@linear
Copy link
Copy Markdown

linear Bot commented May 5, 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Four accuracy fixes against the shipped surface:

- packages/superdoc/AGENTS.md: comments.create takes { target, text },
  not { target, content }. Updated both the table row and the
  programmatic-access example so AI agents copying this guidance
  don't hit a schema rejection.

- track-changes.mdx: theming variables ship as --sd-tracked-changes-*
  (e.g. --sd-tracked-changes-insert-background,
  --sd-tracked-changes-delete-border), not --sd-track-change-*.
  Cited the concrete prefixes a customizer will look for.

- context-menu.mdx: ui.commands has no public execute(id) method.
  Documented the actual dispatch shapes:
  ui.commands.get(id)?.execute(...), ui.commands.require(id).execute(...),
  and ui.toolbar.execute(id, payload) for built-ins.

- navigation.mdx: trackChanges.next() / previous() advance activeId
  and return the new id but don't move the viewport on their own;
  pair them with scrollTo to navigate. Narrowed the story-aware claim
  to trackChanges.scrollTo only; comments.scrollTo is body-scoped
  today.

Brand-voice pass on the new content: tightened the context-menu lede
to shorter sentences, replaced one em-dash range glyph in the
keyboard-syntax line with "through".
The page now jumps from the frontmatter description straight into
Quick start. The previous prose-then-code lede duplicated the work
the description and Quick start already do (orient + show the
shape), and the developer-register pattern in brand voice is "show
first, tell second" — the code in Quick start IS the lede on a
how-to page like this one.
@caio-pizzol caio-pizzol merged commit 0cc2446 into main May 5, 2026
10 of 11 checks passed
@caio-pizzol caio-pizzol deleted the caio/docs-custom-ui-coverage branch May 5, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants