Skip to content

fix(admin): add subscript and superscript formatting#2199

Open
masonjames wants to merge 1 commit into
emdash-cms:mainfrom
masonjames:codex/add-subscript-superscript
Open

fix(admin): add subscript and superscript formatting#2199
masonjames wants to merge 1 commit into
emdash-cms:mainfrom
masonjames:codex/add-subscript-superscript

Conversation

@masonjames

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds subscript and superscript marks to the admin content editor. Both marks are available from the fixed toolbar and text-selection bubble menu, remain active while editing, and round-trip through Portable Text without being dropped.

Closes #2144

Type of change

  • Bug fix
  • Feature (requires maintainer-approved Discussion)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • User-visible strings in the admin UI are wrapped for translation (if applicable). Do not include messages.po changes except in translation PRs — a workflow extracts catalogs on merge to main.
  • I have added a changeset (if this PR changes a published package)
  • New features link to an approved Discussion: Not applicable; this is a maintainer-approved bug fix.

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: OpenAI Codex (GPT-5)

Screenshots / test output

  • pnpm typecheck
  • pnpm lint
  • pnpm --filter @emdash-cms/admin exec vitest run (104 files, 1,239 tests passed)
  • pnpm format
  • User-facing labels are wrapped with Lingui; no catalog files are included.

@changeset-bot

changeset-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: acece22

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 17 packages
Name Type
@emdash-cms/admin Patch
emdash Patch
@emdash-cms/cloudflare Patch
@emdash-cms/sandbox-workerd Patch
@emdash-cms/plugin-mcp-smoke Patch
@emdash-cms/fixture-perf-site Patch
@emdash-cms/perf-demo-site Patch
@emdash-cms/cache-demo-site Patch
@emdash-cms/do-demo-site Patch
@emdash-cms/do-solo-demo-site Patch
@emdash-cms/auth Patch
@emdash-cms/blocks Patch
@emdash-cms/gutenberg-to-portable-text Patch
@emdash-cms/x402 Patch
create-emdash Patch
@emdash-cms/auth-atproto Patch
@emdash-cms/plugin-embeds Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jul 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@2199

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@2199

@emdash-cms/auth-atproto

npm i https://pkg.pr.new/@emdash-cms/auth-atproto@2199

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@2199

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@2199

@emdash-cms/contentful-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/contentful-to-portable-text@2199

emdash

npm i https://pkg.pr.new/emdash@2199

create-emdash

npm i https://pkg.pr.new/create-emdash@2199

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@2199

@emdash-cms/plugin-cli

npm i https://pkg.pr.new/@emdash-cms/plugin-cli@2199

@emdash-cms/plugin-types

npm i https://pkg.pr.new/@emdash-cms/plugin-types@2199

@emdash-cms/registry-client

npm i https://pkg.pr.new/@emdash-cms/registry-client@2199

@emdash-cms/registry-lexicons

npm i https://pkg.pr.new/@emdash-cms/registry-lexicons@2199

@emdash-cms/registry-verification

npm i https://pkg.pr.new/@emdash-cms/registry-verification@2199

@emdash-cms/sandbox-workerd

npm i https://pkg.pr.new/@emdash-cms/sandbox-workerd@2199

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@2199

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@2199

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@2199

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@2199

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@2199

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@2199

@emdash-cms/plugin-field-kit

npm i https://pkg.pr.new/@emdash-cms/plugin-field-kit@2199

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@2199

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@2199

commit: acece22

@masonjames
masonjames marked this pull request as ready for review July 22, 2026 14:35
@github-actions github-actions Bot added the review/needs-review No maintainer or bot review yet label Jul 22, 2026

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the right fix for #2144: it wires official TipTap subscript/superscript extensions into the admin editor the same way bold/italic/strike are already handled, and it plumbs the marks through both directions of the Portable Text converter so they are not dropped on round-trip.

What I checked:

  • Dependencies and catalog entries are correctly pinned to the same ^3.20.0 TipTap version as the other editor extensions.
  • Subscript and Superscript extensions are registered in the TipTap editor and exposed from both the fixed toolbar and the text-selection bubble menu.
  • The activeMarks / editorState selectors reference the correct mark names (subscript/superscript), so button pressed state updates live.
  • The PM → PT converter maps the new marks explicitly, and the PT → PM converter emits the matching ProseMirror marks; without the new case branches the marks would fall through the default and be lost.
  • Toolbar/bubble buttons use t\Subscript`/t`Superscript`for Lingui and includearia-label/aria-pressed`.
  • Tests cover rendering from PT marks to <sub>/<sup> and persisting the marks through onChange after toolbar activation.
  • The changeset is scoped to @emdash-cms/admin and describes the user-visible change.

One non-blocking observation, outside the admin scope of this PR: the core Portable Text converters in packages/core/src/content/converters/ still fall through their default mark handler on the PT → PM path, so marks named subscript/superscript would be dropped there. The admin editor uses its own duplicated converters, so this PR is self-contained and correct, but you may want to mirror the two new cases in the core converters later for any template/plugin code that consumes the public API.

Nothing needs to change before merge.

@github-actions github-actions Bot added review/approved Approved; no new commits since and removed review/needs-review No maintainer or bot review yet labels Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/admin review/approved Approved; no new commits since size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Editor - Subscript and superscript support

1 participant