Skip to content

fix(core): render previews from the newer source in diffs and suggestions - #3157

Merged
nperez0111 merged 2 commits into
feat/versioning-sidebar-ux-bfrom
fix/preview-hidden-source-diff
Oct 6, 2026
Merged

nperez0111 merged 2 commits into
feat/versioning-sidebar-ux-bfrom
fix/preview-hidden-source-diff

Conversation

@YousefED

@YousefED YousefED commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #3090.

Problem

In a version diff or suggestion, editing the source of a math, diagram or other preview block rendered both versions merged together: x^2 → y^3 previewed as xy^23, and a Mermaid node renamed Review → Publish rendered as "RevPubliewsh". Plain content was read with node.textContent, which includes text marked as deleted.

Hovering such a preview also named an arbitrary change ("Deleted by: A"), and hovering a checklist checkbox showed the tooltip of its label's text change.

Changes

  • Previews render the newer source. Plain content (blocks and inline content) leaves out text marked y-attributed-delete (plainContentText in nodeToBlock.ts). The source editor still shows the struck-through and inserted text.
  • Preview tooltips say "Changed" / "Changed by: A". A preview can't show what was inserted or deleted, so AttributionChange gets a "change" kind for hovers through a preview. New changed / changed_by strings in all locales.
  • The preview hover path is scoped to nodes that declare meta.hasPreview or don't display their content, so other controls (checkbox, toggle button) no longer pick up a text change.
  • Suggestion gallery: adds the diagram block and an "Edit a diagram" scenario.

Styled content is unchanged: editor.document still includes deleted text for paragraphs etc. A note in contentNodeToInlineContent covers the trade-offs of filtering it too.

Release notes

  • Custom attribution tooltips can receive modificationType: "change".
  • While suggestions or a version diff are showing, editor.document, onChange and exports read plain blocks (code, math, diagrams) as the newer text.

Tests

  • Core: a plain block in a diff reads as the newer text (fails without the fix: xy^23).
  • Browser:
    • The inline formula renders the shown version (fails without the fix: x+zy).
    • Hovering a checkbox shows no tooltip (fails without the scope guard).
    • Preview tooltips read "Changed".

…ions

Plain content (math, diagrams, custom source blocks) read its text with
deleted text merged in, so a preview rendered neither version ("xy^23").
Plain content now leaves out text marked as deleted.

Hovering such a preview names the change "Changed", since the preview
can't show what was inserted or deleted. The preview path is scoped to
nodes that declare meta.hasPreview or don't display their content, so a
checklist checkbox no longer shows its label's change.

Adds a Mermaid diagram scenario to the suggestion gallery.
@vercel

vercel Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
blocknote Ready Ready Preview Oct 6, 2026 4:46pm UTC
blocknote-website Ready Ready Preview Oct 6, 2026 4:46pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9bbccceb-e710-4686-9765-ee4e410df300

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Oct 6, 2026

Copy link
Copy Markdown

Open in StackBlitz

@blocknote/ariakit

npm i https://pkg.pr.new/@blocknote/ariakit@3157

@blocknote/code-block

npm i https://pkg.pr.new/@blocknote/code-block@3157

@blocknote/core

npm i https://pkg.pr.new/@blocknote/core@3157

@blocknote/diagram-block

npm i https://pkg.pr.new/@blocknote/diagram-block@3157

@blocknote/mantine

npm i https://pkg.pr.new/@blocknote/mantine@3157

@blocknote/math-block

npm i https://pkg.pr.new/@blocknote/math-block@3157

@blocknote/react

npm i https://pkg.pr.new/@blocknote/react@3157

@blocknote/server-util

npm i https://pkg.pr.new/@blocknote/server-util@3157

@blocknote/shadcn

npm i https://pkg.pr.new/@blocknote/shadcn@3157

@blocknote/xl-ai

npm i https://pkg.pr.new/@blocknote/xl-ai@3157

@blocknote/xl-docx-exporter

npm i https://pkg.pr.new/@blocknote/xl-docx-exporter@3157

@blocknote/xl-email-exporter

npm i https://pkg.pr.new/@blocknote/xl-email-exporter@3157

@blocknote/xl-multi-column

npm i https://pkg.pr.new/@blocknote/xl-multi-column@3157

@blocknote/xl-odt-exporter

npm i https://pkg.pr.new/@blocknote/xl-odt-exporter@3157

@blocknote/xl-pdf-exporter

npm i https://pkg.pr.new/@blocknote/xl-pdf-exporter@3157

@blocknote/xl-typst-exporter

npm i https://pkg.pr.new/@blocknote/xl-typst-exporter@3157

commit: 045f94b

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://TypeCellOS.github.io/BlockNote/pr-preview/pr-3157/

Built to branch gh-pages at 2026-10-06 16:54 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@nperez0111
nperez0111 merged commit 7567884 into feat/versioning-sidebar-ux-b Oct 6, 2026
3 of 5 checks passed
@nperez0111
nperez0111 deleted the fix/preview-hidden-source-diff branch October 6, 2026 16:44

This branch was successfully deployed

2 active deployments
Preview – blocknote-website — ba40c2bf Deployed Oct 6, 2026 by vercel[bot]
Preview – blocknote — ba40c2bf Deployed Oct 6, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants