feat(next): improved lexical richText diffing in version view (#11760)

This replaces our JSON-based richtext diffing with HTML-based richtext
diffing for lexical. It uses [this HTML diff
library](https://github.com/Arman19941113/html-diff) 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](https://github.com/user-attachments/assets/811a7c14-d592-4fdc-a1f4-07eeb78255fe)


## After


![CleanShot 2025-03-31 at 18 14
10@2x](https://github.com/user-attachments/assets/efb64da0-4ff8-4965-a458-558a18375c46)
![CleanShot 2025-03-31 at 18 14
26@2x](https://github.com/user-attachments/assets/133652ce-503b-4b86-9c4c-e5c7706d8ea6)
This commit is contained in:
Alessio Gravili
2025-04-02 14:10:20 -06:00
committed by GitHub
parent f34eb228c4
commit d29bdfc10f
43 changed files with 2444 additions and 55 deletions

View File

@@ -0,0 +1,6 @@
@layer payload-default {
.field-diff-label {
margin-bottom: calc(var(--base) * 0.25);
font-weight: 600;
}
}

View File

@@ -0,0 +1,9 @@
import React from 'react'
import './index.scss'
const baseClass = 'field-diff-label'
export const FieldDiffLabel: React.FC<{ children?: React.ReactNode }> = ({ children }) => (
<div className={baseClass}>{children}</div>
)

View File

@@ -367,3 +367,4 @@ export { SetDocumentStepNav } from '../../views/Edit/SetDocumentStepNav/index.js
export { SetDocumentTitle } from '../../views/Edit/SetDocumentTitle/index.js'
export { parseSearchParams } from '../../utilities/parseSearchParams.js'
export { FieldDiffLabel } from '../../elements/FieldDiffLabel/index.js'

View File

@@ -1,3 +1,6 @@
export { FieldDiffLabel } from '../../elements/FieldDiffLabel/index.js'
export { File } from '../../graphics/File/index.js'
export { CheckIcon } from '../../icons/Check/index.js'
export { copyDataFromLocaleHandler } from '../../utilities/copyDataFromLocale.js'
export { renderFilters, renderTable } from '../../utilities/renderTable.js'
export { resolveFilterOptions } from '../../utilities/resolveFilterOptions.js'