Skip to content

fix: stable span key#2409

Draft
christianhg wants to merge 3 commits intomainfrom
fix-stable-span-key
Draft

fix: stable span key#2409
christianhg wants to merge 3 commits intomainfrom
fix-stable-span-key

Conversation

@christianhg
Copy link
Copy Markdown
Member

No description provided.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 24, 2026

⚠️ No Changeset found

Latest commit: 1e4552e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
portable-text-editor-documentation Ready Ready Preview, Comment Mar 24, 2026 9:24am
portable-text-example-basic Ready Ready Preview, Comment Mar 24, 2026 9:24am
portable-text-playground Ready Ready Preview, Comment Mar 24, 2026 9:24am

Request Review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 24, 2026

📦 Bundle Stats — @portabletext/editor

Compared against main (055bdb16)

@portabletext/editor

Metric Value vs main (055bdb1)
Internal (raw) 757.0 KB +2.0 KB, +0.3%
Internal (gzip) 142.3 KB +342 B, +0.2%
Bundled (raw) 1.36 MB +2.0 KB, +0.1%
Bundled (gzip) 305.1 KB +331 B, +0.1%
Import time 98ms -3ms, -2.6%

@portabletext/editor/behaviors

Metric Value vs main (055bdb1)
Internal (raw) 467 B -
Internal (gzip) 207 B -
Bundled (raw) 424 B -
Bundled (gzip) 171 B -
Import time 6ms -0ms, -1.0%

@portabletext/editor/plugins

Metric Value vs main (055bdb1)
Internal (raw) 2.5 KB -
Internal (gzip) 910 B -
Bundled (raw) 2.3 KB -
Bundled (gzip) 839 B -
Import time 12ms -0ms, -0.7%

@portabletext/editor/selectors

Metric Value vs main (055bdb1)
Internal (raw) 60.2 KB -
Internal (gzip) 9.4 KB -
Bundled (raw) 56.7 KB -
Bundled (gzip) 8.6 KB -
Import time 10ms -0ms, -0.2%

@portabletext/editor/utils

Metric Value vs main (055bdb1)
Internal (raw) 24.2 KB -
Internal (gzip) 4.7 KB -
Bundled (raw) 22.2 KB -
Bundled (gzip) 4.4 KB -
Import time 9ms -0ms, -0.9%

🗺️ . · ./behaviors · ./plugins · ./selectors · ./utils · Artifacts

Details
  • Import time regressions over 10% are flagged with ⚠️
  • Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.

When inserting text at a span boundary where the active marks differ
from the focus span but match an adjacent span, move the selection to
the adjacent span instead of creating a new span via insert.child.

This preserves span keys when typing at annotation boundaries where
the DOM selection resolves to the annotated span but the intended
insertion target is the adjacent unannotated span.
Only move the cursor to an adjacent span when it is the immediate
sibling in the children array. This prevents incorrectly jumping
over inline objects to a non-adjacent span with matching marks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant