Skip to content

fix: make Slate tree PT-native#2267

Closed
christianhg wants to merge 1 commit intomainfrom
fix/pt-native-tree
Closed

fix: make Slate tree PT-native#2267
christianhg wants to merge 1 commit intomainfrom
fix/pt-native-tree

Conversation

@christianhg
Copy link
Copy Markdown
Member

What changed

Removes the value wrapper and __inline flag from block objects and inline objects in the Slate tree. PT properties now live directly on Slate nodes.

// Before:
{ _type: 'image', _key: 'abc', children: [void-child], value: { asset: {...} }, __inline: false }

// After:
{ _type: 'image', _key: 'abc', children: [void-child], asset: {...} }

The void-child span stays in Slate's tree for cursor behavior — that's a Slate rendering concern, not a data concern. Everything else is pure PT.

Why

Foundation for container (nested block) support. With the tree PT-native, a container block is just an element with real children — no special wrapping, no void model to work around.

How

  • types/slate.tsVoidElement replaced with ObjectElement (no value, no __inline, just [key: string]: unknown)
  • values.tstoSlateBlock/fromSlateBlock spread PT properties directly instead of wrapping in value
  • apply-operation-to-portable-text.ts — removed all value/__inline unwrapping
  • operation-to-patches.ts — properties read directly from nodes, not from .value
  • applyPatch.ts — patches applied directly to nodes, not to .value
  • slate-plugin.schema.tsisInline uses schema only, no __inline check
  • render.element.tsx / render.inline-object.tsx — schema-based inline detection, direct property access
  • 4 operation files — insert/set/unset/delete all work with direct properties

18 files changed, 151 insertions, 339 deletions (net -188 lines). 317/317 unit tests pass.

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 27, 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 2, 2026 7:52am
portable-text-example-basic Ready Ready Preview, Comment Mar 2, 2026 7:52am
portable-text-playground Ready Ready Preview, Comment Mar 2, 2026 7:52am

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 27, 2026

⚠️ No Changeset found

Latest commit: f1f25b9

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

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