Skip to content
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

feat: improved lexical richText diffing in version view #11760

Merged
merged 46 commits into from
Apr 2, 2025

Conversation

AlessioGr
Copy link
Member

@AlessioGr AlessioGr commented Mar 18, 2025

This replaces our JSON-based richtext diffing with HTML-based richtext diffing for lexical. It uses this HTML diff library that I then modified to handle diffing more complex elements like links, uploads and relationships.

This makes it way easier to spot changes, replacing the lengthy Lexical JSON with a clean visual diff that shows exactly what's different.

Before

CleanShot 2025-03-18 at 13 54 51@2x

After

CleanShot 2025-03-31 at 18 14 10@2x
CleanShot 2025-03-31 at 18 14 26@2x

@jmikrut jmikrut self-requested a review April 2, 2025 19:15
Copy link
Member

@jmikrut jmikrut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick notes for future additions / enhancements:

  • For blocks, we should try and output the labels.singular rather than the slug for human-friendly readability.
  • It would be nice if the relationship component had a relationship icon, so it looks similar to the upload node.
  • We should think through how users can define their own diffing components
  • We already allow users to define their own Diff component for fields - could we also expose this same tactic on a block config? Probably not.. because the Diff component is for JSX (a React component). We need HTML. So maybe we could extend the block config like we did for block.jsx, i.e. block.html?

@AlessioGr AlessioGr enabled auto-merge (squash) April 2, 2025 20:04
@AlessioGr AlessioGr merged commit d29bdfc into main Apr 2, 2025
74 checks passed
@AlessioGr AlessioGr deleted the feat/lexical-diffs branch April 2, 2025 20:10
Copy link
Contributor

github-actions bot commented Apr 4, 2025

🚀 This is included in version v3.33.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants