Repository navigation
Conversation
…aret and host resets
🦋 Changeset detectedLatest commit: 8010026 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 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 |
… document, equal or not
…development Unknown blocks, inlines and marks are handed out as the objects the engine holds, and values nested past one level stayed writable, so a host mutation there changed engine state without throwing.
…after a host change A caret inside the changed range maps to its end, and the end found by the diff can sit inside an emoji sequence or between a letter and its accent. Move the end to the next grapheme boundary.
…wer than what was reported A document the host hands over mid-composition did not move the reported sequence until it was applied, so restoring a reported document right after it was taken for a late echo and ignored.
…ment A host that mutated an emitted document and handed it back had the change ignored as an echo, with no error in development.
… or ticks A node that differs only in type or attributes was replaced whole, which pushed a caret inside it into the next block. Change it in place with setNodeMarkup instead. The specs now also check the caret over generated documents, next to inline elements and in lists.
Turning an inline element into text threw, and a block inserted or removed next to one with the same text retyped the user's block, moving the caret. Restyle only when neither node is text and the parent's child count is unchanged. The generated documents now hold soft breaks.
A user's undo of an attribute change carried the whole old node and so reverted a host restyle of the same block. Host and user attribute changes now use one step per attribute, so undo reverts only what the user changed; a host type change drops the user's step instead.
…nged blocks alone Two separate host changes were applied as one span, which swallowed the blocks between them: a caret there moved and the user's edits there fell out of undo. Unchanged children now anchor the change, changed ones are restyled in place and synced recursively, and only text uses a character diff. A node view stores only attributes that changed.
…t's blocks The comparison limit counted every block, so inserting one block into a document of about 500 or more replaced all of them and moved the caret. The shared start and end are now matched first, and only the stretch between them is compared and counted.
…en syncing Past the comparison limit nothing was matched, so a change at both ends of a long document replaced every block in between. Myers' diff costs grow with the changes, not the length. A block that differs only by an open draft now counts as unchanged, and an inline element whose value alone changed is updated in place, keeping its view and selection.
… of a long document Matching blocks stops past 100 inserted and removed blocks, and a stretch of more than 100 changed blocks is replaced in one step, but for the block holding the caret. A host swapping a 1000-block document took seconds.
…nd add the changeset Myers' forward and backward passes, and the same-length stretch sync, become their own functions so each stays under the cognitive complexity limit. The reversals are statements of their own. Behaviour is unchanged.
… drive composition specs with real events Development freezing tracks the objects it walked instead of reading Object.isFrozen, so a host object frozen only at its top no longer leaves what it holds writable. The host value diff reads Node.children instead of copying them, and the composition specs dispatch compositionstart and compositionend.
…e and specs Ternaries in the specs become statements, the specs' block helpers are typed so no cast is needed, and inline types, literals and the casts that remain are named or justified in one line.
The nested switches inside mapEdit and overlaps become functions of their own, so each outer case is a plain return and SonarCloud's S128 no longer fires.
# Conflicts: # packages/rich-text-editor/src/editor/engines/prosemirror/editing.spec.tsx # packages/rich-text-editor/src/editor/engines/prosemirror/editing.ts
# Conflicts: # packages/rich-text-editor/src/editor/engines/prosemirror/editing.spec.tsx # packages/rich-text-editor/src/editor/engines/prosemirror/editing.ts
✅ Deploy Preview for fondue-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
… undefined as a cleared attribute
The freeze is out of scope for host value sync; the documented rule not to mutate a handed-out document stays.
Cancel hands the saved document back, the way a host discards an edit.
# Conflicts: # packages/rich-text-editor/src/editor/engines/prosemirror/controlApi.ts # packages/rich-text-editor/src/editor/engines/prosemirror/editing.spec.tsx # packages/rich-text-editor/src/editor/engines/prosemirror/editing.ts
# Conflicts: # packages/rich-text-editor/src/editor/RichTextEditor.tsx
Move the sequence diff to its own module, let the composition retry ask the same decision as a new value, keep the report registry out of the pure record, and keep transaction meta keys in one place.
# Conflicts: # packages/rich-text-editor/src/editor/RichTextEditor.tsx # packages/rich-text-editor/src/editor/engines/prosemirror/editing.spec.tsx # packages/rich-text-editor/src/editor/engines/prosemirror/editing.ts # packages/rich-text-editor/src/editor/engines/prosemirror/hostRecord.ts
…d-written diff jsdiff's diffArrays takes a comparator and an edit-length limit, which is all the hand-written Myers pass did.
# Conflicts: # packages/rich-text-editor/src/editor/engines/prosemirror/editing.ts # packages/rich-text-editor/src/editor/engines/prosemirror/hostRecord.ts
# Conflicts: # packages/rich-text-editor/src/editor/engines/prosemirror/editing.ts
This branch has not been deployed
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.
Hosts that control the editor through
value, such as comment editing and guideline autosave, hand back a cleaned-up or saved copy of the document. Each new copy replaced the whole content, so every save moved the caret, wiped undo and broke IME input.The editor now applies a new
valueas a change to the current document, the way y-prosemirror applies remote edits.Before and after
valuemoved the caret to the end of the document. Now the caret and the selection stay where they were, as Google Docs keeps a local caret through remote edits.valuewiped the user's undo history. Now undo takes back only the user's own edits, as the Yjs undo manager does. An edit that the host change replaces leaves the history.valuebroke the word being composed. Now the editor waits until the word is done.Blocks are matched with jsdiff's
diffArrays, a new dependency (diff). The text diff needsIntl.Segmenter, which every browser in thedefaultsbrowserslist query supports.How to test
Each case needs a new
valuewhile the editor has focus, which no story does. Theediting.spec.tsxblocks "a document set by the host", "a document set by the host that changes the blocks around the caret" and "a document set by the host while text is being composed" cover them.Stacked on #3110.
FP-756