@payloadcms/richtext-lexical 3.35.0-internal.5e55452 → 3.35.0-internal.b3d367c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/exports/client/bundled.css +1 -1
- package/dist/field/Diff/index.d.ts +0 -1
- package/dist/field/Diff/index.d.ts.map +1 -1
- package/dist/field/Diff/index.js +28 -33
- package/dist/field/Diff/index.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/package.json +6 -6
- package/dist/field/Diff/htmlDiff/index.d.ts +0 -63
- package/dist/field/Diff/htmlDiff/index.d.ts.map +0 -1
- package/dist/field/Diff/htmlDiff/index.js +0 -501
- package/dist/field/Diff/htmlDiff/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/field/Diff/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/field/Diff/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,SAAS,CAAA;AAI/D,OAAO,cAAc,CAAA;AACrB,OAAO,gBAAgB,CAAA;AAgBvB,eAAO,MAAM,oBAAoB,EAAE,gCAwDlC,CAAA"}
|
package/dist/field/Diff/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
2
|
-
import {
|
|
3
|
-
import { FieldDiffLabel } from '@payloadcms/ui/rsc';
|
|
4
|
-
import React from 'react';
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FieldDiffContainer, getHTMLDiffComponents } from '@payloadcms/ui/rsc';
|
|
5
3
|
import '../bundled.css';
|
|
4
|
+
import React from 'react';
|
|
6
5
|
import { convertLexicalToHTMLAsync } from '../../features/converters/lexicalToHtml/async/index.js';
|
|
7
6
|
import { getPayloadPopulateFn } from '../../features/converters/utilities/payloadPopulateFn.js';
|
|
8
7
|
import { LinkDiffHTMLConverterAsync } from './converters/link.js';
|
|
@@ -10,15 +9,15 @@ import { ListItemDiffHTMLConverterAsync } from './converters/listitem/index.js';
|
|
|
10
9
|
import { RelationshipDiffHTMLConverterAsync } from './converters/relationship/index.js';
|
|
11
10
|
import { UnknownDiffHTMLConverterAsync } from './converters/unknown/index.js';
|
|
12
11
|
import { UploadDiffHTMLConverterAsync } from './converters/upload/index.js';
|
|
13
|
-
import { HtmlDiff } from './htmlDiff/index.js';
|
|
14
12
|
const baseClass = 'lexical-diff';
|
|
15
13
|
export const LexicalDiffComponent = async args => {
|
|
16
14
|
const {
|
|
17
|
-
comparisonValue,
|
|
15
|
+
comparisonValue: valueFrom,
|
|
18
16
|
field,
|
|
19
17
|
i18n,
|
|
20
18
|
locale,
|
|
21
|
-
|
|
19
|
+
nestingLevel,
|
|
20
|
+
versionValue: valueTo
|
|
22
21
|
} = args;
|
|
23
22
|
const converters = ({
|
|
24
23
|
defaultConverters
|
|
@@ -44,39 +43,35 @@ export const LexicalDiffComponent = async args => {
|
|
|
44
43
|
depth: 1,
|
|
45
44
|
req: args.req
|
|
46
45
|
});
|
|
47
|
-
const
|
|
46
|
+
const fromHTML = await convertLexicalToHTMLAsync({
|
|
48
47
|
converters,
|
|
49
|
-
data:
|
|
48
|
+
data: valueFrom,
|
|
49
|
+
disableContainer: true,
|
|
50
50
|
populate: payloadPopulateFn
|
|
51
51
|
});
|
|
52
|
-
const
|
|
52
|
+
const toHTML = await convertLexicalToHTMLAsync({
|
|
53
53
|
converters,
|
|
54
|
-
data:
|
|
54
|
+
data: valueTo,
|
|
55
|
+
disableContainer: true,
|
|
55
56
|
populate: payloadPopulateFn
|
|
56
57
|
});
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
const {
|
|
59
|
+
From,
|
|
60
|
+
To
|
|
61
|
+
} = getHTMLDiffComponents({
|
|
62
|
+
fromHTML,
|
|
63
|
+
toHTML
|
|
64
|
+
});
|
|
65
|
+
return /*#__PURE__*/_jsx(FieldDiffContainer, {
|
|
60
66
|
className: baseClass,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
className: `${baseClass}__diff-old`,
|
|
70
|
-
dangerouslySetInnerHTML: {
|
|
71
|
-
__html: oldHTML
|
|
72
|
-
}
|
|
73
|
-
}), newHTML && /*#__PURE__*/_jsx("div", {
|
|
74
|
-
className: `${baseClass}__diff-new`,
|
|
75
|
-
dangerouslySetInnerHTML: {
|
|
76
|
-
__html: newHTML
|
|
77
|
-
}
|
|
78
|
-
})]
|
|
79
|
-
})]
|
|
67
|
+
From: From,
|
|
68
|
+
i18n: i18n,
|
|
69
|
+
label: {
|
|
70
|
+
label: field.label,
|
|
71
|
+
locale
|
|
72
|
+
},
|
|
73
|
+
nestingLevel: nestingLevel,
|
|
74
|
+
To: To
|
|
80
75
|
});
|
|
81
76
|
};
|
|
82
77
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["FieldDiffContainer","getHTMLDiffComponents","React","convertLexicalToHTMLAsync","getPayloadPopulateFn","LinkDiffHTMLConverterAsync","ListItemDiffHTMLConverterAsync","RelationshipDiffHTMLConverterAsync","UnknownDiffHTMLConverterAsync","UploadDiffHTMLConverterAsync","baseClass","LexicalDiffComponent","args","comparisonValue","valueFrom","field","i18n","locale","nestingLevel","versionValue","valueTo","converters","defaultConverters","req","payloadPopulateFn","currentDepth","depth","fromHTML","data","disableContainer","populate","toHTML","From","To","_jsx","className","label"],"sources":["../../../src/field/Diff/index.tsx"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\nimport type { RichTextFieldDiffServerComponent } from 'payload'\n\nimport { FieldDiffContainer, getHTMLDiffComponents } from '@payloadcms/ui/rsc'\n\nimport './index.scss'\nimport '../bundled.css'\n\nimport React from 'react'\n\nimport type { HTMLConvertersFunctionAsync } from '../../features/converters/lexicalToHtml/async/types.js'\n\nimport { convertLexicalToHTMLAsync } from '../../features/converters/lexicalToHtml/async/index.js'\nimport { getPayloadPopulateFn } from '../../features/converters/utilities/payloadPopulateFn.js'\nimport { LinkDiffHTMLConverterAsync } from './converters/link.js'\nimport { ListItemDiffHTMLConverterAsync } from './converters/listitem/index.js'\nimport { RelationshipDiffHTMLConverterAsync } from './converters/relationship/index.js'\nimport { UnknownDiffHTMLConverterAsync } from './converters/unknown/index.js'\nimport { UploadDiffHTMLConverterAsync } from './converters/upload/index.js'\n\nconst baseClass = 'lexical-diff'\n\nexport const LexicalDiffComponent: RichTextFieldDiffServerComponent = async (args) => {\n const {\n comparisonValue: valueFrom,\n field,\n i18n,\n locale,\n nestingLevel,\n versionValue: valueTo,\n } = args\n\n const converters: HTMLConvertersFunctionAsync = ({ defaultConverters }) => ({\n ...defaultConverters,\n ...LinkDiffHTMLConverterAsync({}),\n ...ListItemDiffHTMLConverterAsync,\n ...UploadDiffHTMLConverterAsync({ i18n: args.i18n, req: args.req }),\n ...RelationshipDiffHTMLConverterAsync({ i18n: args.i18n, req: args.req }),\n ...UnknownDiffHTMLConverterAsync({ i18n: args.i18n, req: args.req }),\n })\n\n const payloadPopulateFn = await getPayloadPopulateFn({\n currentDepth: 0,\n depth: 1,\n req: args.req,\n })\n const fromHTML = await convertLexicalToHTMLAsync({\n converters,\n data: valueFrom as SerializedEditorState,\n disableContainer: true,\n populate: payloadPopulateFn,\n })\n\n const toHTML = await convertLexicalToHTMLAsync({\n converters,\n data: valueTo as SerializedEditorState,\n disableContainer: true,\n populate: payloadPopulateFn,\n })\n\n const { From, To } = getHTMLDiffComponents({\n fromHTML,\n toHTML,\n })\n\n return (\n <FieldDiffContainer\n className={baseClass}\n From={From}\n i18n={i18n}\n label={{\n label: field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