Y prosemirror v14 visualization fixes#2875
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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/mantine
@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
commit: |
Improve suggestion (track-changes) diff rendering for y-prosemirror v14
Summary
Improves how BlockNote renders suggestion / track-changes diffs under the y-prosemirror v14 attribution system, and substantially expands the y-prosemirror visual test suite.
Previously, deleted blocks always showed a "DELETED" badge + author-color highlight regardless of content; several CSS chains broke when content was wrapped in suggestion marks (headings lost their level, list markers disappeared); and concurrent suggestions all rendered in a single color. This addresses all of those.
Rendering changes (
packages/core/src/editor/Block.css)Deletions are now decided per block, by content type:
<tr>/<td>can't host the card).Fixed CSS chains broken by suggestion-mark wrappers:
paragraph → headingdiffs now render the heading at the correct level.Insertions use the same per-block treatment: non-inline inserts (e.g. an inserted image) get the author-color card; inline inserts keep only their inline text highlight (no redundant block-level band).
Care was taken to keep anything layout-hazardous off the shared
.bn-block-content—width: fit-contentis gated on the media wrapper (:has(> .bn-file-block-content-wrapper)), so width-less blocks can't collapse.Test changes (
tests/src/end-to-end/y-prosemirror/)addRemoveBlockswith new scenarios: insert/delete image, delete divider / code block / mixed parent (paragraph + image), nested lists, colored blocks, etc.typeChanges,nesting): the assertions checked the wrong document index — in suggestion mode a type change keeps the original as a deletion and inserts the new block, so the new type lives atdocument[1], not[0].concurrentSuggestionFixture(the local stand-in for YHub's server-side attribution). It records each transaction's author and feeds theDiffAttributionManager, so User A's and User B's changes render in distinct colors — including in the merged view.Known limitations / follow-ups
A deletes a row, B adds a column) is kepttest.fails: it intermittently crashes the merge with a yjsUnexpected case. Documented as a flaky, not-yet-pinned-down crash, with prosemirror-tables'fixTablesas the leading (unconfirmed) suspect.•/◦/▪) still render as•at every level (TODO: needs a JS-computeddata-bullet-level— the marker chains can't be fixed in CSS through the wrappers).