Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
@blocknote/ariakit
@blocknote/code-block
@blocknote/core
@blocknote/diagram-block
@blocknote/mantine
@blocknote/math-block
@blocknote/react
@blocknote/server-util
@blocknote/shadcn
@blocknote/xl-ai
@blocknote/xl-docx-exporter
@blocknote/xl-email-exporter
@blocknote/xl-multi-column
@blocknote/xl-odt-exporter
@blocknote/xl-pdf-exporter
@blocknote/xl-typst-exporter
commit: |
YousefED
force-pushed
the
feat/version-diff-block-copies
branch
from
October 8, 2026 14:25
5d897d2 to
f95aa7b
Compare
YousefED
changed the base branch from
feat/versioning-sidebar-ux-b
to
fix/version-diff-cascade-attribution
October 8, 2026 14:26
YousefED
force-pushed
the
feat/version-diff-block-copies
branch
from
October 8, 2026 14:28
f95aa7b to
de283f6
Compare
YousefED
force-pushed
the
feat/version-diff-block-copies
branch
from
October 8, 2026 14:30
de283f6 to
fe4831e
Compare
YousefED
added this pull request to stack #3174
October 8, 2026 14:30
3 of 4 tasks
|
YousefED
force-pushed
the
feat/version-diff-block-copies
branch
from
October 8, 2026 20:38
fe4831e to
bb192fe
Compare
YousefED
added a commit
to YousefED/docs-1
that referenced
this pull request
Oct 8, 2026
Use the pkg.pr.new build of TypeCellOS/BlockNote#3172 at bb192fe8fc. This build replaces the two experimental version diff flags with one versionDiffFixes option. Signed-off-by: yousefed <yousefdardiry@gmail.com>
…tal) Behind `experimental.blockCopyDiffs` in the collaboration options; it only changes what a version diff shows. A type change or a move stores a copy of the block, so the diff showed it as a deleted and an inserted block, with the copied content credited to whoever made the change. Pair each copy with its original (by block id) and show it once: - a type change between text blocks as a formatting change; - a move, including an indent, as "Moved"; - a copy in the same place (its children changed) as unchanged. Copied content keeps its authors. Content the earlier version had that no copy kept still shows as deleted.
…ier version A block copied twice between two versions (indented, then outdented; retyped twice) leaves an intermediate copy that is deleted too. The pairing could pick that copy as the original, and credit the final copy to whoever made the intermediate one. It now pairs with the block of the earlier version; without one, several candidates aren't paired. Also from the stack review: the version diff never writes to the document (checked for each value of the option), the moved-text highlight shares the inserted-text rules, and Remove a column has its own note.
A block re-created more than once between two versions (retyped, then indented; moved twice) is a chain of copies, each deleted by the update that inserts the next. Follow the chain back by those updates' users and times, so text typed into an intermediate copy keeps its writer. Content added to the original after the earlier version is credited to whoever added it, not shown as unchanged. Also: the pairing no longer recomputes reading order or scans all removed items for each copy.
YousefED
force-pushed
the
feat/version-diff-block-copies
branch
from
October 9, 2026 09:54
bb192fe to
7fa4b13
Compare
Collaborator
Author
|
Closed: merged into #3166, which now has both experimental version diff fixes (implicit delete attribution and re-created blocks) behind one option. |
This branch was successfully 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.
Stacked on #3166.
Summary
This PR shows a type change or a move of a block once in a version diff. It is behind an experimental option:
collaboration.experimental.versionDiffFixes: "implicitDeleteAttributionAndRecreatedBlocks". This value also includes the fix of #3166 ("implicitDeleteAttribution"). The option changes only what the version diff shows. It does not change the stored document.Problem
In Yjs, the type of a node cannot change. Thus, a type change or a move re-creates the block: it stores a copy of the block (with the same block id) and deletes the original. The version diff showed the original as deleted and the copy as inserted. The diff also credited all the copied content to the user who made the change.
Examples:
Solution
When the diff is rendered, we pair each copy with its original (by block id). Then we show the pair once:
Copied content keeps its original authors, character by character. This also applies when you compare with the first version: the copied text is credited to the users who inserted the original text.
A block can be re-created more than once between two versions: for example, retyped and then indented, or moved twice. The copies then form a chain. Each copy is deleted by the update that inserts the next copy. We follow the chain back by the users and times of these updates. Thus:
We do not pair a copy with its original when the copy lost content. For example, a concurrent edit deleted text from the original. In this case, the diff shows a delete and an insert, as before.
A type change between a text block and a block without inline content (for example, paragraph to image) is not paired.
Display:
Block.cssgives the text element the highlight of inserted text. In a code block, the highlight uses the dark variant of inserted code. A moved block without inline content (image, file, table, divider) gets the card of a formatting change.movedattribute, as the insert mark does. The tooltip shows "Moved" for both.Not fixed
Testing
The tests are in #3090. On #3090, 12 markers say "To be fixed by #3172" and the tests are marked
it.fails. This PR changes them to normal tests:versionDiffAttribution.test.ts:nestingChanges.test.ts: an indent and an unindent show as one moved block.This PR removes the #3166 test "attributes a move to the mover". With this fix, an indent shows as moved and not as deleted.
versionDiffFlags.test.ts: each value of the option, for 4 scenarios. Each value stores the same updates, and showing a diff never writes to the document (no update, and the same bytes before and after).versioning.test.tsx): without the option, all scenarios are the same as on feat!: rebuild version history and customize snapshot actions #3090. With the option, 15 scenarios change. Each of these scenarios has a note for the option in the gallery.