Repository navigation
Version Packages (next) - #3601
ecoscript[bot] wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Bundle Stats✅ No significant changes. All scenario measurements (34)🗺️
Significant means at least 1.0 KB and 1% gzip, or at least 5 ms and 10% import time. |
ceea316 to
8e11fc3
Compare
8e11fc3 to
aeaa7aa
Compare
aeaa7aa to
f349a41
Compare
f349a41 to
5764775
Compare
5764775 to
ad2e251
Compare
ad2e251 to
c0ce8e3
Compare
5be0027 to
c42d128
Compare
c42d128 to
a92235e
Compare
a92235e to
8e1d98b
Compare
8e1d98b to
bde2719
Compare
bde2719 to
2b1ce11
Compare
2b1ce11 to
7ce3ee7
Compare
7ce3ee7 to
c198946
Compare
c198946 to
6631aa6
Compare
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to next, this PR will be updated.
nextis currently in pre mode so this branch has prereleases rather than normal releases. If you want to exit prereleases, runchangeset pre exitonnext.Releases
@portabletext/editor@9.0.0-next.0
Major Changes
#3619
b993cecThanks @christianhg! - feat!: replace thepatchesevent withapplyeditor.send({type: 'apply', patches})applies patches that came from someone else, such as a collaborator's change arriving from your backend. It replaces thepatchesevent, which is removed along with thePatchesEventtype.The patches apply in order as another writer's change. They don't become steps in your undo history, and the caret stays put in text they don't touch. If they change the content, the editor emits one remote
changeevent, followed by acorrection: truechange if it had to fix something. Anunsetof the whole value clears the undo history.Every patch counts as another writer's, so the patches need no
originand there is nosnapshotto pass. If you relayed your own editor's patches back to it markedorigin: 'local', stop sending those, sinceapplywould apply them a second time.The
ApplyEventtype is exported.Minor Changes
#3413
77b4cdaThanks @christianhg! - feat: emitchangeevents for local and remote changes, with corrections markedThe editor now emits a
changeevent, synchronously, every time its content changes. Each event carries theoperationsthe editor applied to its content (the publicOperationtype), never the input it received:origin: 'local': what a user action did, including everything the action's Behaviors raised. Undo and redo are one action each. Local changes arrive in application order, and one user action can produce several when the editor fixes something mid-action.patchesholds the change as Sanity patches, the same patches thepatchevent emits for the action, available as soon as the action finishes instead of on themutationevent's debounced schedule.origin: 'local'withcorrection: true: the editor's own fixes to the content, such as merging adjacent spans that share marks after a paste, or replacing a duplicate_key. A correction follows the change that caused it, with its own operations and patches. Fixes to content the editor received throughapplyorupdate valueare corrections too. Registering or unregistering a node witheditor.registerNodeafter load can make the editor fix existing content, and those fixes are corrections. A host that saves every local change'spatchessaves corrections as well. A correction to received content arrives even when the editor drops it frommutationbecause a newer value or a conflicting remote patch arrived first. When the editor repairs a value it receives, by giving a child without a_keya new key, adding an empty span to a text block without children, or removing an unused mark definition, the repair is a correction too, and the remotechangeholds the value as received, without the repair. Every child without a_keygets its own key in that correction. Corrections are never held back: a correction to the initial value, or to a value received while the editor is read-only, carriespatcheseven though the editor sends nopatchormutationevents for it.origin: 'remote': one event perapplyevent and perupdate valuethat changed the content. When anoperationlistener sends a Behavior event or registers a node while anupdate valueis applied, that change is emitted in between, so theupdate valuearrives as a remote event before it and another after it. Remote changes carry nopatches.Every
changeof one action is delivered before anychangethat a listener sets off while receiving them. Loading the initial value emits nochange, except acorrectionwhen the editor fixes the loaded value, and achangenever has an emptyoperationsarray. The empty block the editor shows in an empty field is part of the snapshot and never reported, but when the editor puts one back later, because the last block was deleted or another writer unset the field, its insert is in theoperationsof the change that caused it. After a remote unset it arrives as acorrectionwith nopatches, since the field is already gone. A long initial value that the editor loads across several ticks counts as one load, so its fixes arrive as onecorrection.ChangeEventis exported as a beta type.EditorEmittedEventgains thechangemember, so exhaustive switches overevent.typegain a case.An
operationlistener now sees a block the editor repairs on arrival as it was received, followed by each repair as its owninsert. A received text block with three or more children without a_keynow gets their key patches in index order. When the DOM selection leaves a read-only editor's content, the editor now deselects through theselectevent withat: null, so Behaviors listening toselectsee it.Patch Changes
#3655
216fb52Thanks @christianhg! - fix: render large block lists in chunks at every depthTyping in a large document no longer rebuilds an element for every block in the list being edited. At 20,000 root blocks, a keystroke improves from about 180ms to 81ms. Typing 20 keys in a 2,000-block callout improves from about 930ms to 660ms. Splitting a block with Enter at 8,000 root blocks improves from about 104ms to 51ms. Block lists at the editor root and inside registered containers render in chunks whose elements are reused unless their blocks or container scope changed. Blocks keep their DOM nodes when chunks split or merge, so the caret, selection and IME composition are unaffected and the rendered DOM is unchanged. A chunk an edit leaves with 50 blocks or fewer is merged into a neighbour when the two hold 200 blocks or fewer together.
#3608
91d91a4Thanks @christianhg! - fix: resolve paths with one walk and drop operations that address nothingA path with two node segments and no field name between them, such as
[{_key: 'b1'}, {_key: 's1'}]or[0, 0], now addresses nothing at any depth: at the root, inside a container, inside a container inside a container, and inside a block object's own Portable Text field. A Behavior event, a remote patch, aselector a range decoration at such a path changes nothing, emits nopatchand nochange, and logs nothing. The other patches in the sameapplyevent still apply. Aselectat such a path keeps the current selection, and a range decoration with such an endpoint is never listed, rendered or mapped.An edit at a well-formed path whose key is not in the document also changes nothing and emits nothing. Previously a
set,unsetorinsertat a missing key still emitted a patch, and anunsetorinsertat a missing span key loggedCannot apply an "unset" (node removal) operation at path ... because the node was not found. The event still reaches Behaviors, and aselectat a missing key behaves as before.#3602
be03281Thanks @pepahlavacek! - fix: keep the caret after pasted blocks inserted mid-block#3616
e4e4d1bThanks @christianhg! - fix: address the item counted from the end when its key is empty or shared with a siblingA remote patch at a negative index now changes the item counted from the end of the array, like Sanity, even when that item's key is empty or shared with a sibling. Before, such a patch could land on another item with the same key.
#3607
0bab687Thanks @christianhg! - fix: resolve negative indexes in remote patch paths from the end of the arrayRemote
set,unsetand single-iteminsertpatches with negative indexes now resolve from the end of the array at any depth, like Sanity. A negative index that falls before the start of the array changes nothing, except that an insert at-1into an empty array still inserts.#3634
b3125b6Thanks @christianhg! - fix: remove a block or span whensetgives it a non-object valueA
setof a block or span to a value that is not an object, such asnullor a string, now removes it. Before, the block stayed on screen while the host receivedset null, so anything typed in it afterwards was lost.@portabletext/plugin-character-pair-decorator@9.0.28-next.0
Patch Changes
216fb52,91d91a4,77b4cda,be03281,e4e4d1b,0bab687,b3125b6,b993cec]:@portabletext/plugin-decorations@1.0.15-next.0
Patch Changes
216fb52,91d91a4,77b4cda,be03281,e4e4d1b,0bab687,b3125b6,b993cec]:@portabletext/plugin-dnd@2.0.29-next.0
Patch Changes
216fb52,91d91a4,77b4cda,be03281,e4e4d1b,0bab687,b3125b6,b993cec]:@portabletext/plugin-emoji-picker@8.0.28-next.0
Patch Changes
216fb52,91d91a4,77b4cda,be03281,e4e4d1b,0bab687,b3125b6,b993cec]:@portabletext/plugin-input-rule@7.0.28-next.0
Patch Changes
216fb52,91d91a4,77b4cda,be03281,e4e4d1b,0bab687,b3125b6,b993cec]:@portabletext/plugin-list-index@2.0.27-next.0
Patch Changes
216fb52,91d91a4,77b4cda,be03281,e4e4d1b,0bab687,b3125b6,b993cec]:@portabletext/plugin-markdown-shortcuts@9.0.28-next.0
Patch Changes
216fb52,91d91a4,77b4cda,be03281,e4e4d1b,0bab687,b3125b6,b993cec]:@portabletext/plugin-one-line@8.0.27-next.0
Patch Changes
216fb52,91d91a4,77b4cda,be03281,e4e4d1b,0bab687,b3125b6,b993cec]:@portabletext/plugin-paste-link@5.0.27-next.0
Patch Changes
216fb52,91d91a4,77b4cda,be03281,e4e4d1b,0bab687,b3125b6,b993cec]:@portabletext/plugin-table@2.0.27-next.0
Patch Changes
216fb52,91d91a4,77b4cda,be03281,e4e4d1b,0bab687,b3125b6,b993cec]:@portabletext/plugin-typeahead-picker@7.0.28-next.0
Patch Changes
216fb52,91d91a4,77b4cda,be03281,e4e4d1b,0bab687,b3125b6,b993cec]:@portabletext/plugin-typography@9.0.28-next.0
Patch Changes
216fb52,91d91a4,77b4cda,be03281,e4e4d1b,0bab687,b3125b6,b993cec]:@portabletext/toolbar@9.0.28-next.0
Patch Changes
216fb52,91d91a4,77b4cda,be03281,e4e4d1b,0bab687,b3125b6,b993cec]:Note
High Risk
Major breaking API (
patches→apply) plus newchangeevent semantics affect collaboration, persistence, and any exhaustive event handling; incorrect migration can double-apply patches or miss saves.Overview
This Changesets release PR bumps versions and changelogs only—no new implementation in the diff. It cuts
@portabletext/editor@9.0.0-next.0(prerelease onnext) and republishes all editor plugins/toolbar packages that depend on it to matching*-next.0versions.@portabletext/editor9.0.0-next.0 bundles prior work already onnext: Breaking: remote collaboration input moves fromeditor.send({type: 'patches', ...})toapply(nosnapshot/ per-patchorigin;PatchesEventremoved). Feature: synchronouschangeevents for local, remote, and correction flows, with localpatchesfor saving. Fixes: chunked rendering for huge block lists, stricter path resolution (invalid/missing paths no-op without spurious patches), caret after mid-block paste, Sanity-aligned negative array indexes on remote patches, and removing blocks/spans whensetreceives non-object values.Integrators upgrading to this prerelease must migrate off the
patchesevent and may need to listen forchangeinstead of relying only onpatch/mutationtiming.Reviewed by Cursor Bugbot for commit 8806cdf. Bugbot is set up for automated code reviews on this repo. Configure here.