Smart set_node: relax text/children constraints for void elements#2224
Draft
christianhg wants to merge 1 commit intomainfrom
Draft
Smart set_node: relax text/children constraints for void elements#2224christianhg wants to merge 1 commit intomainfrom
christianhg wants to merge 1 commit intomainfrom
Conversation
🦋 Changeset detectedLatest commit: f05452c The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
christianhg
added a commit
that referenced
this pull request
Feb 20, 2026
The childless voids commit (e1d2c4c) reverted the smart set_node guards from PR #2224 back to unconditional text/children rejection. Restores context-aware guards in both locations: - general.ts (operation handler): only throw for 'text' on Text nodes, only throw for 'children' on non-void Elements - set-nodes.ts (Transforms.setNodes): same conditional filtering Uses instance methods (editor.isText, editor.isElement, editor.isVoid) consistent with the Phase 2 migration. Also fixes prettier formatting on 8 files flagged by CI.
3a640a2 to
2907698
Compare
745f64e to
f3ea445
Compare
f3ea445 to
eb079dc
Compare
eb079dc to
f05452c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Relaxes the
set_nodeoperation constraints so thattextandchildrenproperties are only rejected when they would violate Slate's data model — not unconditionally.What changed
general.ts(operation handler):text: Only throws for Text nodes (must useinsert_text/remove_textfor history correctness)children: Only throws for non-void Elements (structural children must not be set directly)set-nodes.ts(Transforms.setNodes):textskipped for Text nodes,childrenskipped for non-void Elementsapply-operation-to-portable-text.ts(PT value layer):childrenwhen applyingset_nodeto object nodes, preventing Slate void-child internals from leaking into portable text outputWhy
Opens a path for PR 3 (childless voids + value unification) to set properties on void elements via
set_nodeoperations. No behavior change for non-void nodes — existing tests pass unchanged.Base branch
Based on
feat-vendor-slate(PR #2188).