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  ## After  
This commit is contained in:
6
packages/ui/src/elements/FieldDiffLabel/index.scss
Normal file
6
packages/ui/src/elements/FieldDiffLabel/index.scss
Normal file
@@ -0,0 +1,6 @@
|
||||
@layer payload-default {
|
||||
.field-diff-label {
|
||||
margin-bottom: calc(var(--base) * 0.25);
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
9
packages/ui/src/elements/FieldDiffLabel/index.tsx
Normal file
9
packages/ui/src/elements/FieldDiffLabel/index.tsx
Normal 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>
|
||||
)
|
||||
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user