Repository navigation
Upgrade to slate 0.142.1 and sync the bundled history with slate-history - #5172
Merged
Merged
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
🦋 Changeset detectedLatest commit: 37826dd The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 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 |
# Conflicts: # apps/www/package.json # packages/core/package.json # packages/slate/package.json # packages/test-utils/package.json # pnpm-lock.yaml
# Conflicts: # apps/www/package.json # packages/core/package.json # packages/slate/package.json # packages/test-utils/package.json # pnpm-lock.yaml
…rging Port slate-history 0.140.0 (ianstormtaylor/slate#6308) to the bundled history: a new undo step starts only once the document is normalized.
This was referenced Oct 16, 2026
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.
Plan (when applicable): none.
Why
mainpins slate 0.132.0, slate-dom 0.132.0, slate-react 0.132.0 and slate-hyperscript 0.129.1. This PR moves Plate to the latest releases: slate 0.142.1, slate-dom 0.142.0, slate-react 0.142.0 and slate-hyperscript 0.138.3. The releases in between carry Android and IME input fixes, Firefox and WebKit caret fixes, scrolling fixes and core transform fixes.The upgrade needs two changes in
@platejs/slate:hasRange. slate 0.134 addededitor.hasRangeto core, andDOMEditor.hasRangenow delegates to it.syncLegacyMethodscopies core editor methods intoeditor.api, so core'shasRange, which throws on a missing range, replaced Plate's try/catch version.Scope
packages/core,packages/slate,packages/test-utils,apps/www: bump the slate packages. The lockfile changes only the slate entries.packages/slate/src/internal/dom-editor/hasRange.ts: calls slate'shasRangeinside the existing try/catch.create-editor.tsalso assigns it toeditor.hasRange, soeditor.hasRange,editor.api.hasRangeandDOMEditor.hasRangeshare one implementation and can't call each other in a loop.packages/slate/src/slate-history/history.ts:withoutSaving,withoutMerging,withMergingandwithNewBatchrestore their flags infinally(slate #5837, #6063).withNewBatchkeeps the outer split (#6063).packages/slate/src/slate-history/with-history.ts:withoutMerging, a transform's normalization stays in the same undo step as the transform (#6308).setNodesBatchandcloneRange.@platejs/coreand@platejs/slatepatch.Blast radius
Every Plate editor gets the new slate, slate-dom and slate-react. These are the changes since 0.132 that users or plugin authors may notice:
insertFragmentonce instead ofinsertTextper line, with aninsert_nodeper middle line instead of asplit_node(slate #6265). Plugins that overrideinsertTextto catch multi-line pastes no longer see them. Editors withMarkdownPluginparse plain text first and don't reach this path. Pasting a block void such as an image mid-block now splits the block (#5937).Intl.Segmenter, so Chinese, Japanese and Thai text steps by word (#6268).editOnly, because Plate'spipeHandleralready decides that per plugin.editor.onDOMError, which callsreportErrorby default (#6266). An invalidmergeNodescall that mixes block and inline children now throws instead of letting normalization discard content (#6304).insertTextkeeps a null selection unless called withselect: true(#6281). Copied HTML keeps list wrappers when the selection spans list items (#6241). The placeholder setsaria-placeholderon the editor root andaria-hiddenon its span (#6306).The history changes affect undo grouping only in these cases: a callback that throws, a nested
withNewBatch, a selection change followed by an edit in the same tick, and normalization insidewithoutMerging.Verification
pnpm checkexits 0 on the head commit (workflow check, lint, typecheck,test:all,test:slowest). CI is green.packages/slate/src/slate-history/upstream-parity.spec.tsx: one case per history fix.packages/slate/src/internal/dom-editor/hasRange.spec.ts: the missing-range case throws without the fix./blocks/playgroundwith slate 0.142.1, Chromium: typing, Enter, word delete, undo and redo grouping, and multi-line plain-text paste with a one-step undo. No console errors. An earlier run on 0.136 covered Chromium, Firefox and WebKit, including bold, markdown shortcuts, select-all delete, copy and paste, and Chinese IME composition in Chromium.