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
#3723
e99d949Thanks @christianhg! - feat!: remove thepatchandmutationeventsThe
patchandmutationevents and theMutationEventtype are removed. Listen tochangeinstead. Localchange.patchesare emitted at once, including fixes on load and while the editor is read-only.Read
editor.getSnapshot().context.valueinstead ofmutation.value. There is no typing debounce. To take a burst of changes at once, listen witheditor.on('change', listener, {batch: true}), and the listener receives the burst'schangeevents as one array. To relay local patches to another editor, send each localchange'spatchesin order. With{batch: true}, you can send a whole burst in oneapplyby concatenating the local events' patches in order.Before:
After:
#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 a local change 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.#3654
0b3524cThanks @christianhg! - feat!: remove theupdate valueevent and value validationThe
update valueevent and thevalue changedandinvalid valuenotifications are removed, along with theInvalidValueResolutiontype. The initial value is read once frominitialConfigand loads in one step. To show another document or a new snapshot of the same document, remount with akey:The editor no longer validates the value it receives, but it still removes
null, string, number, boolean and array entries and emits the removal as a local change. A block of a type the schema does not know shows as a block object. A start value with a missing_keygets its key as a local change withpatches. A root block with an empty or missing_keyor no_typeused to drop content from the start value. It now shows, and its key or the schema's text block type is emitted as a local change withpatches. A block with no_typealready got the same fix through remote patches and inside containers. A span outside a text block now throws on render too, as it already did for remote patches. An unused mark definition is kept.operationlisteners see onesetof the whole value on mount, followed by the editor's own fixes.Minor Changes
#3413
77b4cdaThanks @christianhg! - feat: emitchangeevents for local and remote changesThe 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': one event for a user action, including everything the action's Behaviors raised and any fixes it caused, such as merging adjacent spans that share marks after a paste. Undo and redo are one action each. Operations and patches stay in application order.patchesholds the change as Sanity patches, available as soon as the action finishes. A fix that no user action caused is its own local change. That covers fixes after loading the value, after a value arrives throughapply(also while the editor is read-only), and after registering or unregistering a node witheditor.registerNode. When the editor repairs a value it receives, every child without a_keygets a new_key, and a text block without children gets an empty span. The remotechangeholds the value as received, without the repair. A fix'spatchesare emitted at once, without waiting for the editor to become editable.origin: 'remote': one event perapplyevent that changed the content. Remote changes carry nopatches.A remote
changeand the localchangethat fixes it are delivered before anychangethat a listener sets off while receiving them. A localchangeis too. Loading the initial value emits nochange, except a local change when 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 a local change withpatches: [], since the field is already gone.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 own operation. A child without a_keygets its key through asetoperation. Anoperationlistener sees thatsetwith the origin of the received content, soremotefor a loaded or applied value. Thesetitself is in a localchange. 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 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.#3662
a8e5f6bThanks @christianhg! - fix: remove non-object entries at any depthA
null, string, number, boolean or array entry that a collaborator's patch puts in the value is now removed, at the root, in a text block's children and annotations, and in container fields at any depth. Such entries in a start value are removed too. Each removal emits anunsetpatch that addresses the entry by index, so the host's copy stays equal to the editor's. Before, these entries could crash the editor or stay in the host's copy.Node lookups such as
getNodenow return nothing for a non-object entry, and traversal skips it.#3602
be03281Thanks @pepahlavacek! - fix: keep the caret after pasted blocks inserted mid-block#3720
9758101Thanks @christianhg! - fix: draw a misplaced span or text block as an objectA span where a block belongs, or a text block inside another text block's
children, is now drawn as an object box, not as editable text. The editor keeps these nodes as received and sends no correction patches for them. A collaborator's misplaced span no longer crashes the editable. Backspace just after a misplaced text block removes it and joins the text around it.The traversal functions in
@portabletext/editor/traversaltreat these nodes as objects.getSpanandgetTextBlockreturn nothing for them.getBlockandisLeafObjecttreat a misplaced span as a block object, andgetTextreturns''for it.getChildren,getNodeandgetNodesdo not go into a text block inside another text block'schildren, andgetAnnotationdoes not read itsmarkDefs.getFocusChildandgetAnchorChildreturn a text block inside a text block'schildrenas an inline object. Inline object bracketing can add an empty span beside it, as it does beside any inline object.#3702
c822e68Thanks @christianhg! - fix: write and read editor paths in Sanity's path formatA nested field named
true,falseornullis now written in its quoted form, as@sanity/util/pathswrites it. A block inside a container field namednullnow hasdata-pt-path[_key=="k0"]["null"][_key=="k1"]instead of[_key=="k0"].null[_key=="k1"], and itsblockIndexMapkey changes the same way. Selectors and code that read those keys need the new form. Every otherdata-pt-pathvalue andblockIndexMapkey is unchanged.#3762
b560b03Thanks @christianhg! - fix: rebase undo and redo only against remote patches that changed the valueUndo after a remote patch that didn't apply now undoes the local edit. Previously the editor recorded every incoming remote patch for undo and redo to rebase against, including one that changed nothing, such as a stale
diffMatchPatchwhose hunks don't match the current text. Undo then rebased the local edit over a change that never happened, and the edit could stay in place:A remote whole-value
unsetstill clears the undo and redo stacks.#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.#3756
5824234Thanks @christianhg! - fix: emit no operation for a remote patch that cannot change a fieldA remote
diffMatchPatchon a string outside span text, such as a block'sstyle, no longer emits anoperationevent when the resulting string is identical to the current one. That covers a stale diff whose hunks all miss and a diff that leaves the string as it is. Previously both emitted asetoperation writing the current string back. A diff whose hunks match only in part still emits asetwhen the hunks that match change the string.A remote range
unseton a field that isn't an array no longer emits anoperationevent either. Previously it emitted an operation at the range path, though the field was unchanged:#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.Updated dependencies [
9b432f7,28b16ee]:@portabletext/plugin-character-pair-decorator@10.0.0-next.0
Major Changes
#3712
b32d78aThanks @christianhg! - feat!: remove the deprecatedschemaargument from thedecoratorcallbackThe
decoratorcallback ofCharacterPairDecoratorPluginno longer receives a top-levelschema. Readcontext.schemainstead, which is the schema at the caret.Patch Changes
216fb52,91d91a4,a8e5f6b,77b4cda,be03281,9758101,c822e68,b560b03,e4e4d1b,0bab687,5824234,b3125b6,e99d949,b993cec,0b3524c]:@portabletext/plugin-markdown-shortcuts@10.0.0-next.0
Major Changes
#3712
f8f688bThanks @christianhg! - feat!: remove the deprecatedschemaandlevelarguments from the config callbacksThe callbacks of
MarkdownShortcutsPlugin(blockquoteStyle,defaultStyle,headingStyle,unorderedList,orderedList,boldDecorator,codeDecorator,italicDecoratorandstrikeThroughDecorator) no longer receive a top-levelschema. Readcontext.schemainstead, which is the schema at the caret.headingStyleno longer receives a top-levelleveleither, so readprops.level.Patch Changes
216fb52,91d91a4,a8e5f6b,77b4cda,be03281,9758101,c822e68,b560b03,e4e4d1b,0bab687,5824234,b32d78a,b3125b6,e99d949,b993cec,0b3524c]:@portabletext/repair@2.0.0-next.0
Major Changes
#3675
9b432f7Thanks @christianhg! - feat!: remove non-object array entriesA string, number, boolean, null or array entry in an array of objects is removed with one
unsetcorrection.A correction can now contain an
unsetpatch. Code that applies corrections must handleunsetas well asset.StructuralRulegains'non-object', so an exhaustive switch over correction types needs a new case.#3720
28b16eeThanks @christianhg! - fix!: stop setting spantextoutside a text block and text blockchildreninside onegetStructuralCorrectionno longer returns aspan-textcorrection for a span whose parent is missing or is not a text block, such as a span at the root or in a container field. It no longer returns amissing-childrencorrection for a text block inside another text block. Thenon-object,missing-type,missing-keyandduplicate-keyrules are unchanged. Code that relied on those two corrections must apply them itself.@portabletext/plugin-decorations@1.0.17-next.0
Patch Changes
216fb52,91d91a4,a8e5f6b,77b4cda,be03281,9758101,c822e68,b560b03,e4e4d1b,0bab687,5824234,b3125b6,e99d949,b993cec,0b3524c]:@portabletext/plugin-dnd@2.0.31-next.0
Patch Changes
#3702
ff692fcThanks @christianhg! - fix(plugin-dnd): write drop position keys in the editor's path formatuseDropPositionfinds the drop position for a block by a string built from its path. That string now follows the editor's path format. An array index is written as[2]instead of.2, so it can no longer match a field named"2", and a nested field namedtrue,falseornullis written as["null"]. Drop positions for keyed paths are found as before.Updated dependencies [
216fb52,91d91a4,a8e5f6b,77b4cda,be03281,9758101,c822e68,b560b03,e4e4d1b,0bab687,5824234,b3125b6,e99d949,b993cec,0b3524c]:@portabletext/plugin-emoji-picker@8.0.30-next.0
Patch Changes
216fb52,91d91a4,a8e5f6b,77b4cda,be03281,9758101,c822e68,b560b03,e4e4d1b,0bab687,5824234,b3125b6,e99d949,b993cec,0b3524c]:@portabletext/plugin-input-rule@7.0.30-next.0
Patch Changes
216fb52,91d91a4,a8e5f6b,77b4cda,be03281,9758101,c822e68,b560b03,e4e4d1b,0bab687,5824234,b3125b6,e99d949,b993cec,0b3524c]:@portabletext/plugin-list-index@2.0.29-next.0
Patch Changes
#3702
ac02df7Thanks @christianhg! - fix(plugin-list-index): write list index keys in the editor's path formatuseListIndexfinds the list number for a block by a string built from its path. That string now follows the editor's path format. An array index is written as[2]instead of.2, so it can no longer match a field named"2", and a nested field namedtrue,falseornullis written as["null"]. List numbers for keyed paths are unchanged.Updated dependencies [
216fb52,91d91a4,a8e5f6b,77b4cda,be03281,9758101,c822e68,b560b03,e4e4d1b,0bab687,5824234,b3125b6,e99d949,b993cec,0b3524c]:@portabletext/plugin-one-line@8.0.29-next.0
Patch Changes
216fb52,91d91a4,a8e5f6b,77b4cda,be03281,9758101,c822e68,b560b03,e4e4d1b,0bab687,5824234,b3125b6,e99d949,b993cec,0b3524c]:@portabletext/plugin-paste-link@5.0.29-next.0
Patch Changes
216fb52,91d91a4,a8e5f6b,77b4cda,be03281,9758101,c822e68,b560b03,e4e4d1b,0bab687,5824234,b3125b6,e99d949,b993cec,0b3524c]:@portabletext/plugin-table@2.0.29-next.0
Patch Changes
216fb52,91d91a4,a8e5f6b,77b4cda,be03281,9758101,c822e68,b560b03,e4e4d1b,0bab687,5824234,b3125b6,e99d949,b993cec,0b3524c]:@portabletext/plugin-typeahead-picker@7.0.30-next.0
Patch Changes
216fb52,91d91a4,a8e5f6b,77b4cda,be03281,9758101,c822e68,b560b03,e4e4d1b,0bab687,5824234,b3125b6,e99d949,b993cec,0b3524c]:@portabletext/plugin-typography@9.0.30-next.0
Patch Changes
216fb52,91d91a4,a8e5f6b,77b4cda,be03281,9758101,c822e68,b560b03,e4e4d1b,0bab687,5824234,b3125b6,e99d949,b993cec,0b3524c]:@portabletext/toolbar@9.0.30-next.0
Patch Changes
216fb52,91d91a4,a8e5f6b,77b4cda,be03281,9758101,c822e68,b560b03,e4e4d1b,0bab687,5824234,b3125b6,e99d949,b993cec,0b3524c]:Note
High Risk
Publishing a major editor prerelease with breaking event/value APIs and dependent plugin majors will break integrators until they migrate listeners and
applyusage.Overview
This Changesets release PR bumps package versions and appends changelog entries only—no application source changes in the diff itself. Merging publishes the accumulated work on
nextas npm prereleases.@portabletext/editor@9.0.0-next.0 is the headline: breaking API shifts—
mutation/patchlisteners becomechange(with optional{batch: true}), remote sync useseditor.send({type: 'apply', patches})instead ofpatches, andupdate valueplus value validation are removed (remountEditorProviderwith akeyto swap documents). The release also documents performance (chunked block rendering), collaboration fixes (paths, negative indexes, undo rebase, no-op remote ops), and misplacement/non-object handling.@portabletext/repair@2.0.0-next.0 adds
unsetcorrections for non-object array entries and stops auto-fixing certain misplaced nodes. @portabletext/plugin-character-pair-decorator@10.0.0-next.0 and @portabletext/plugin-markdown-shortcuts@10.0.0-next.0 drop deprecated callback args (schema,level) in favor ofcontext.schemaandprops. Remaining plugins/toolbar get patch-level bumps aligned to editor 9 and path-format tweaks in plugin-dnd and plugin-list-index.Reviewed by Cursor Bugbot for commit 8b30153. Bugbot is set up for automated code reviews on this repo. Configure here.