Repository navigation
[lexical-website] Documentation Update: Add the limit of text nodes made again with other text to the @lexical/y docs #9556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -810,6 +810,21 @@ not merge as a user might expect: | |
| that outdents an item of such a list is a delete in the nested list's | ||
| container and an insert in the list's: text a collaborator types in those | ||
| items at the same time is lost (only lists stored in that older shape). | ||
| - **Text nodes made again with other text.** Where an update replaces a | ||
| line's text nodes with new ones and the line's text changed (an AI rewrite | ||
| that makes a block's text nodes again with one word changed, or removes a | ||
| block's children and appends one new text node), a replaced node whose | ||
| text is not all there unchanged is written again whole: its characters are | ||
| deleted, and the new text is inserted. What a collaborator types into that | ||
|
Comment on lines
+816
to
+818
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Optional, non-blocking: a remade node whose text did not change keeps its characters only where it lines up from the start or the end of the replaced text. With |
||
| text at the same time, which the update's author has not seen, stays where | ||
| it was, so it lands outside the new text, before it (a letter typed at the | ||
| end of a word ends up in front of the rewritten text, out of its word), | ||
|
Comment on lines
+819
to
+821
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Optional, non-blocking: a letter typed at the very end of the replaced text can land after the new text instead: |
||
| and the collaborator's formatting of that text at the same time is not | ||
| kept. The concurrent typed text is kept, and every client shows the same | ||
|
Comment on lines
+822
to
+823
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Optional, non-blocking: formatting that reaches the end of the replaced text is not dropped but can cover all of the new text. With |
||
| result. Edit the changed | ||
| words in place instead (`TextNode#spliceText`, the selection's | ||
| `insertText`; see [Edits made by code](#edits-made-by-code-agents-tools)): | ||
| only the changed characters are written. | ||
| - **Delete wins.** Text typed into a container that a collaborator deletes at | ||
| the same time is deleted with it, and so is a block moved into it. | ||
| - **Last writer wins** for the fields of one link (URL and target change | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC the text merge transform is going to splice TextNode back together at least in a left-biased way if the other matching conditions are met before the update is committed and then relayed to collab, so a split-then-join should be indistinguishable from a setTextContent splice unless there's something blocking the merge altogether or the changed content isn't a prefix. We could add a different bias in
$mergeTextNodesto prefer preserving an existing node on merge even if it is on the right.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And if the problem is that it doesn't call
TextNode.spliceText(after the bias heuristic is changed), we could probably haveTextNode.mergeWithSiblingcall it?