Skip to content

fix: move text/plain inherit-formatting to deserialize.data#2425

Merged
christianhg merged 1 commit intomainfrom
feat/text-plain-deserialize-data
Mar 29, 2026
Merged

fix: move text/plain inherit-formatting to deserialize.data#2425
christianhg merged 1 commit intomainfrom
feat/text-plain-deserialize-data

Conversation

@christianhg
Copy link
Copy Markdown
Member

The text/plain inherit-formatting behavior previously ran on deserialization.success, which meant it intercepted and stripped structure from any blocks produced by consumer deserialize.data behaviors. A consumer hooking into deserialize.data to parse markdown from the clipboard and produce rich blocks (headings, code blocks, etc.) would have those blocks reduced to plain text runs because the deserialization.success handler only kept text from text blocks.

This moves the inherit-formatting logic up to deserialize.data, where it runs the converter inline and extracts text runs in the guard. The key ordering change: the text/plain inherit-formatting behavior is now a deserialize.data behavior that sits below consumer BehaviorPlugin behaviors in priority. When a consumer behavior matches deserialize.data for text/plain, it runs first and raises deserialization.success with its rich blocks. The abstract text/plain behavior never fires. When no consumer behavior matches, the abstract behavior handles it the same as before — extracting text runs and inserting spans with active decorators.

The deserialization.success handler is now a simple passthrough to insert.blocks for all mime types.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 29, 2026

🦋 Changeset detected

Latest commit: b128e21

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

This PR includes changesets to release 11 packages
Name Type
@portabletext/editor Patch
@portabletext/plugin-character-pair-decorator Patch
@portabletext/plugin-emoji-picker Patch
@portabletext/plugin-input-rule Patch
@portabletext/plugin-markdown-shortcuts Patch
@portabletext/plugin-one-line Patch
@portabletext/plugin-paste-link Patch
@portabletext/plugin-sdk-value Patch
@portabletext/plugin-typeahead-picker Patch
@portabletext/plugin-typography Patch
@portabletext/toolbar 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

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 29, 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 29, 2026 9:30am
portable-text-example-basic Ready Ready Preview, Comment Mar 29, 2026 9:30am
portable-text-playground Ready Ready Preview, Comment Mar 29, 2026 9:30am

Request Review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 29, 2026

📦 Bundle Stats — @portabletext/editor

Compared against main (86bc0474)

@portabletext/editor

Metric Value vs main (86bc047)
Internal (raw) 760.8 KB +515 B, +0.1%
Internal (gzip) 143.0 KB +58 B, +0.0%
Bundled (raw) 1.37 MB +521 B, +0.0%
Bundled (gzip) 305.9 KB +61 B, +0.0%
Import time 100ms +2ms, +2.0%

@portabletext/editor/behaviors

Metric Value vs main (86bc047)
Internal (raw) 467 B -
Internal (gzip) 207 B -
Bundled (raw) 424 B -
Bundled (gzip) 171 B -
Import time 6ms +0ms, +0.9%

@portabletext/editor/plugins

Metric Value vs main (86bc047)
Internal (raw) 2.5 KB -
Internal (gzip) 910 B -
Bundled (raw) 2.3 KB -
Bundled (gzip) 839 B -
Import time 12ms +0ms, +1.1%

@portabletext/editor/selectors

Metric Value vs main (86bc047)
Internal (raw) 60.5 KB -
Internal (gzip) 9.5 KB -
Bundled (raw) 56.9 KB -
Bundled (gzip) 8.7 KB -
Import time 10ms +0ms, +1.7%

@portabletext/editor/utils

Metric Value vs main (86bc047)
Internal (raw) 24.2 KB -
Internal (gzip) 4.7 KB -
Bundled (raw) 22.2 KB -
Bundled (gzip) 4.4 KB -
Import time 9ms +0ms, +1.1%

🗺️ . · ./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.

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