fix(admin): add subscript and superscript formatting#2199
Conversation
🦋 Changeset detectedLatest commit: acece22 The changes in this PR will be included in the next version bump. This PR includes changesets to release 17 packages
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 |
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/auth-atproto
@emdash-cms/blocks
@emdash-cms/cloudflare
@emdash-cms/contentful-to-portable-text
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/plugin-cli
@emdash-cms/plugin-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@emdash-cms/registry-verification
@emdash-cms/sandbox-workerd
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-field-kit
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
There was a problem hiding this comment.
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.0TipTap version as the other editor extensions. SubscriptandSuperscriptextensions are registered in the TipTap editor and exposed from both the fixed toolbar and the text-selection bubble menu.- The
activeMarks/editorStateselectors 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
casebranches the marks would fall through thedefaultand 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 throughonChangeafter toolbar activation. - The changeset is scoped to
@emdash-cms/adminand 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.
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
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runmessages.pochanges except in translation PRs — a workflow extracts catalogs on merge tomain.AI-generated code disclosure
Screenshots / test output
pnpm typecheckpnpm lintpnpm --filter @emdash-cms/admin exec vitest run(104 files, 1,239 tests passed)pnpm format