@payloadcms/richtext-lexical 3.68.0-internal-debug.185cc5f → 3.68.0-internal-debug.591ab42
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/cell/rscEntry.js +13 -5
- package/dist/cell/rscEntry.js.map +1 -1
- package/dist/features/blocks/client/component/BlockContent.js +29 -9
- package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
- package/dist/features/blocks/client/component/components/BlockCollapsible.js +7 -3
- package/dist/features/blocks/client/component/components/BlockCollapsible.js.map +1 -1
- package/dist/features/blocks/client/component/components/BlockEditButton.js +6 -2
- package/dist/features/blocks/client/component/components/BlockEditButton.js.map +1 -1
- package/dist/features/blocks/client/component/components/BlockRemoveButton.js +6 -2
- package/dist/features/blocks/client/component/components/BlockRemoveButton.js.map +1 -1
- package/dist/features/blocks/client/component/index.js +123 -43
- package/dist/features/blocks/client/component/index.js.map +1 -1
- package/dist/features/blocks/client/component/index.scss +188 -0
- package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js +7 -3
- package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js.map +1 -1
- package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js +6 -2
- package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js.map +1 -1
- package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js +6 -2
- package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js.map +1 -1
- package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js +6 -2
- package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js.map +1 -1
- package/dist/features/blocks/client/componentInline/index.js +117 -37
- package/dist/features/blocks/client/componentInline/index.js.map +1 -1
- package/dist/features/blocks/client/componentInline/index.scss +90 -0
- package/dist/features/blocks/client/getBlockImageComponent.js +7 -3
- package/dist/features/blocks/client/getBlockImageComponent.js.map +1 -1
- package/dist/features/blocks/client/nodes/BlocksNode.js +7 -3
- package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
- package/dist/features/blocks/client/nodes/InlineBlocksNode.js +7 -3
- package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Block.js +87 -27
- package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Code.js +7 -3
- package/dist/features/blocks/premade/CodeBlock/Component/Code.js.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js +12 -4
- package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.scss +6 -0
- package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js +18 -6
- package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.scss +29 -0
- package/dist/features/blocks/premade/CodeBlock/Component/index.scss +97 -0
- package/dist/features/converters/lexicalToJSX/Component/index.js +9 -5
- package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js +7 -3
- package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +7 -3
- package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js +6 -2
- package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js +6 -2
- package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/link.js +13 -5
- package/dist/features/converters/lexicalToJSX/converter/converters/link.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/list.js +38 -14
- package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js +18 -6
- package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/table.js +31 -11
- package/dist/features/converters/lexicalToJSX/converter/converters/table.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/text.js +43 -15
- package/dist/features/converters/lexicalToJSX/converter/converters/text.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/upload.js +31 -11
- package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/index.js +8 -4
- package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
- package/dist/features/debug/jsxConverter/client/plugin/index.js +13 -5
- package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
- package/dist/features/debug/jsxConverter/client/plugin/style.scss +12 -0
- package/dist/features/debug/testRecorder/client/plugin/index.js +61 -21
- package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
- package/dist/features/debug/testRecorder/client/plugin/index.scss +53 -0
- package/dist/features/debug/treeView/client/plugin/index.js +7 -3
- package/dist/features/debug/treeView/client/plugin/index.js.map +1 -1
- package/dist/features/debug/treeView/client/plugin/index.scss +80 -0
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +224 -72
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.scss +87 -0
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +31 -11
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.scss +11 -0
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +21 -9
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +25 -9
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.scss +233 -0
- package/dist/features/horizontalRule/client/plugin/index.scss +23 -0
- package/dist/features/indent/client/IndentPlugin.js +6 -2
- package/dist/features/indent/client/IndentPlugin.js.map +1 -1
- package/dist/features/link/client/plugins/clickableLink/index.js +6 -2
- package/dist/features/link/client/plugins/clickableLink/index.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +76 -24
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/index.js +7 -3
- package/dist/features/link/client/plugins/floatingLinkEditor/index.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/index.scss +92 -0
- package/dist/features/lists/checklist/client/plugin/index.js +6 -2
- package/dist/features/lists/checklist/client/plugin/index.js.map +1 -1
- package/dist/features/lists/plugin/index.js +6 -2
- package/dist/features/lists/plugin/index.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js +13 -5
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js +7 -3
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.scss +16 -0
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js +13 -5
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js +7 -3
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.scss +16 -0
- package/dist/features/relationship/client/components/RelationshipComponent.js +55 -19
- package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
- package/dist/features/relationship/client/components/index.scss +95 -0
- package/dist/features/relationship/client/drawer/index.js +18 -6
- package/dist/features/relationship/client/drawer/index.js.map +1 -1
- package/dist/features/relationship/client/nodes/RelationshipNode.js +7 -3
- package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
- package/dist/features/relationship/client/plugins/index.js +7 -3
- package/dist/features/relationship/client/plugins/index.js.map +1 -1
- package/dist/features/textState/feature.client.js +18 -6
- package/dist/features/textState/feature.client.js.map +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.js +71 -23
- package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.scss +113 -0
- package/dist/features/toolbars/inline/client/Toolbar/index.js +71 -23
- package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/inline/client/Toolbar/index.scss +58 -0
- package/dist/features/toolbars/shared/ToolbarButton/index.js +7 -3
- package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarButton/index.scss +46 -0
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +60 -20
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js +36 -12
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.scss +129 -0
- package/dist/features/upload/client/component/index.js +91 -31
- package/dist/features/upload/client/component/index.js.map +1 -1
- package/dist/features/upload/client/component/index.scss +191 -0
- package/dist/features/upload/client/component/pending/index.js +13 -5
- package/dist/features/upload/client/component/pending/index.js.map +1 -1
- package/dist/features/upload/client/drawer/index.js +18 -6
- package/dist/features/upload/client/drawer/index.js.map +1 -1
- package/dist/features/upload/client/nodes/UploadNode.js +12 -4
- package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
- package/dist/features/upload/client/plugin/index.js +7 -3
- package/dist/features/upload/client/plugin/index.js.map +1 -1
- package/dist/field/Diff/converters/listitem/index.js +36 -12
- package/dist/field/Diff/converters/listitem/index.js.map +1 -1
- package/dist/field/Diff/converters/listitem/index.scss +47 -0
- package/dist/field/Diff/converters/relationship/index.js +36 -12
- package/dist/field/Diff/converters/relationship/index.js.map +1 -1
- package/dist/field/Diff/converters/relationship/index.scss +73 -0
- package/dist/field/Diff/converters/unknown/index.js +30 -10
- package/dist/field/Diff/converters/unknown/index.js.map +1 -1
- package/dist/field/Diff/converters/unknown/index.scss +40 -0
- package/dist/field/Diff/converters/upload/index.js +59 -19
- package/dist/field/Diff/converters/upload/index.js.map +1 -1
- package/dist/field/Diff/converters/upload/index.scss +115 -0
- package/dist/field/Diff/index.js +7 -3
- package/dist/field/Diff/index.js.map +1 -1
- package/dist/field/Diff/index.scss +102 -0
- package/dist/field/Field.js +79 -27
- package/dist/field/Field.js.map +1 -1
- package/dist/field/RenderLexical/index.js +36 -12
- package/dist/field/RenderLexical/index.js.map +1 -1
- package/dist/field/index.js +19 -7
- package/dist/field/index.js.map +1 -1
- package/dist/field/index.scss +41 -0
- package/dist/field/rscEntry.js +7 -3
- package/dist/field/rscEntry.js.map +1 -1
- package/dist/lexical/EditorPlugin.js +13 -5
- package/dist/lexical/EditorPlugin.js.map +1 -1
- package/dist/lexical/LexicalEditor.js +162 -50
- package/dist/lexical/LexicalEditor.js.map +1 -1
- package/dist/lexical/LexicalEditor.scss +54 -0
- package/dist/lexical/LexicalProvider.js +49 -17
- package/dist/lexical/LexicalProvider.js.map +1 -1
- package/dist/lexical/config/client/EditorConfigProvider.js +7 -3
- package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
- package/dist/lexical/plugins/DecoratorPlugin/index.scss +13 -0
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +19 -7
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.scss +54 -0
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +7 -3
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/index.js +48 -16
- package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/index.scss +68 -0
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +19 -7
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.scss +35 -0
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +31 -11
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.scss +80 -0
- package/dist/lexical/theme/EditorTheme.scss +357 -0
- package/dist/lexical/ui/ContentEditable.js +13 -5
- package/dist/lexical/ui/ContentEditable.js.map +1 -1
- package/dist/lexical/ui/ContentEditable.scss +105 -0
- package/dist/lexical/ui/icons/AI/index.js +37 -13
- package/dist/lexical/ui/icons/AI/index.js.map +1 -1
- package/dist/lexical/ui/icons/Add/index.js +19 -7
- package/dist/lexical/ui/icons/Add/index.js.map +1 -1
- package/dist/lexical/ui/icons/AlignCenter/index.js +25 -9
- package/dist/lexical/ui/icons/AlignCenter/index.js.map +1 -1
- package/dist/lexical/ui/icons/AlignJustify/index.js +25 -9
- package/dist/lexical/ui/icons/AlignJustify/index.js.map +1 -1
- package/dist/lexical/ui/icons/AlignLeft/index.js +25 -9
- package/dist/lexical/ui/icons/AlignLeft/index.js.map +1 -1
- package/dist/lexical/ui/icons/AlignRight/index.js +25 -9
- package/dist/lexical/ui/icons/AlignRight/index.js.map +1 -1
- package/dist/lexical/ui/icons/Block/index.js +25 -9
- package/dist/lexical/ui/icons/Block/index.js.map +1 -1
- package/dist/lexical/ui/icons/Blockquote/index.js +13 -5
- package/dist/lexical/ui/icons/Blockquote/index.js.map +1 -1
- package/dist/lexical/ui/icons/Bold/index.js +13 -5
- package/dist/lexical/ui/icons/Bold/index.js.map +1 -1
- package/dist/lexical/ui/icons/Checklist/index.js +19 -7
- package/dist/lexical/ui/icons/Checklist/index.js.map +1 -1
- package/dist/lexical/ui/icons/Code/index.js +19 -7
- package/dist/lexical/ui/icons/Code/index.js.map +1 -1
- package/dist/lexical/ui/icons/CodeBlock/index.js +13 -5
- package/dist/lexical/ui/icons/CodeBlock/index.js.map +1 -1
- package/dist/lexical/ui/icons/Collapse/index.js +13 -5
- package/dist/lexical/ui/icons/Collapse/index.js.map +1 -1
- package/dist/lexical/ui/icons/H1/index.js +13 -5
- package/dist/lexical/ui/icons/H1/index.js.map +1 -1
- package/dist/lexical/ui/icons/H2/index.js +13 -5
- package/dist/lexical/ui/icons/H2/index.js.map +1 -1
- package/dist/lexical/ui/icons/H3/index.js +13 -5
- package/dist/lexical/ui/icons/H3/index.js.map +1 -1
- package/dist/lexical/ui/icons/H4/index.js +13 -5
- package/dist/lexical/ui/icons/H4/index.js.map +1 -1
- package/dist/lexical/ui/icons/H5/index.js +13 -5
- package/dist/lexical/ui/icons/H5/index.js.map +1 -1
- package/dist/lexical/ui/icons/H6/index.js +13 -5
- package/dist/lexical/ui/icons/H6/index.js.map +1 -1
- package/dist/lexical/ui/icons/HorizontalRule/index.js +13 -5
- package/dist/lexical/ui/icons/HorizontalRule/index.js.map +1 -1
- package/dist/lexical/ui/icons/IndentDecrease/index.js +31 -11
- package/dist/lexical/ui/icons/IndentDecrease/index.js.map +1 -1
- package/dist/lexical/ui/icons/IndentIncrease/index.js +31 -11
- package/dist/lexical/ui/icons/IndentIncrease/index.js.map +1 -1
- package/dist/lexical/ui/icons/InlineBlocks/index.js +13 -5
- package/dist/lexical/ui/icons/InlineBlocks/index.js.map +1 -1
- package/dist/lexical/ui/icons/Italic/index.js +13 -5
- package/dist/lexical/ui/icons/Italic/index.js.map +1 -1
- package/dist/lexical/ui/icons/Link/index.js +13 -5
- package/dist/lexical/ui/icons/Link/index.js.map +1 -1
- package/dist/lexical/ui/icons/Meatballs/index.js +25 -9
- package/dist/lexical/ui/icons/Meatballs/index.js.map +1 -1
- package/dist/lexical/ui/icons/OrderedList/index.js +37 -13
- package/dist/lexical/ui/icons/OrderedList/index.js.map +1 -1
- package/dist/lexical/ui/icons/Relationship/index.js +37 -13
- package/dist/lexical/ui/icons/Relationship/index.js.map +1 -1
- package/dist/lexical/ui/icons/Strikethrough/index.js +19 -7
- package/dist/lexical/ui/icons/Strikethrough/index.js.map +1 -1
- package/dist/lexical/ui/icons/Subscript/index.js +13 -5
- package/dist/lexical/ui/icons/Subscript/index.js.map +1 -1
- package/dist/lexical/ui/icons/Superscript/index.js +13 -5
- package/dist/lexical/ui/icons/Superscript/index.js.map +1 -1
- package/dist/lexical/ui/icons/Table/index.js +13 -5
- package/dist/lexical/ui/icons/Table/index.js.map +1 -1
- package/dist/lexical/ui/icons/Text/index.js +13 -5
- package/dist/lexical/ui/icons/Text/index.js.map +1 -1
- package/dist/lexical/ui/icons/TextState/index.js +7 -3
- package/dist/lexical/ui/icons/TextState/index.js.map +1 -1
- package/dist/lexical/ui/icons/Underline/index.js +19 -7
- package/dist/lexical/ui/icons/Underline/index.js.map +1 -1
- package/dist/lexical/ui/icons/UnorderedList/index.js +43 -15
- package/dist/lexical/ui/icons/UnorderedList/index.js.map +1 -1
- package/dist/lexical/ui/icons/Upload/index.js +25 -9
- package/dist/lexical/ui/icons/Upload/index.js.map +1 -1
- package/dist/utilities/fieldsDrawer/Drawer.js +19 -7
- package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
- package/dist/utilities/fieldsDrawer/DrawerContent.js +19 -7
- package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
- package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js +7 -3
- package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js.map +1 -1
- package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js +7 -3
- package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js.map +1 -1
- package/package.json +9 -8
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
@import '~@payloadcms/ui/scss';
|
|
2
|
+
|
|
3
|
+
@layer payload-default {
|
|
4
|
+
.lexical-diff .lexical-relationship-diff {
|
|
5
|
+
@extend %body;
|
|
6
|
+
@include shadow-sm;
|
|
7
|
+
min-width: calc(var(--base) * 8);
|
|
8
|
+
max-width: fit-content;
|
|
9
|
+
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
background-color: var(--theme-input-bg);
|
|
13
|
+
border-radius: $style-radius-s;
|
|
14
|
+
border: 1px solid var(--theme-elevation-100);
|
|
15
|
+
position: relative;
|
|
16
|
+
font-family: var(--font-body);
|
|
17
|
+
margin-block: base(0.5);
|
|
18
|
+
max-height: calc(var(--base) * 4);
|
|
19
|
+
padding: base(0.6);
|
|
20
|
+
|
|
21
|
+
&[data-match-type='create'] {
|
|
22
|
+
border-color: var(--diff-create-pill-border);
|
|
23
|
+
color: var(--diff-create-parent-color);
|
|
24
|
+
|
|
25
|
+
.lexical-relationship-diff__collectionLabel {
|
|
26
|
+
color: var(--diff-create-link-color);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.lexical-relationship-diff__title * {
|
|
30
|
+
color: var(--diff-create-parent-color);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&[data-match-type='delete'] {
|
|
35
|
+
border-color: var(--diff-delete-pill-border);
|
|
36
|
+
color: var(--diff-delete-parent-color);
|
|
37
|
+
text-decoration-line: none;
|
|
38
|
+
background-color: var(--diff-delete-pill-bg);
|
|
39
|
+
|
|
40
|
+
.lexical-relationship-diff__collectionLabel {
|
|
41
|
+
color: var(--diff-delete-link-color);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
* {
|
|
45
|
+
text-decoration-line: none;
|
|
46
|
+
color: var(--diff-delete-parent-color);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&__card {
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
width: 100%;
|
|
54
|
+
flex-grow: 1;
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: flex-start;
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
justify-content: space-between;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&__title {
|
|
62
|
+
display: flex;
|
|
63
|
+
flex-direction: row;
|
|
64
|
+
font-weight: 600;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&__collectionLabel {
|
|
68
|
+
overflow: hidden;
|
|
69
|
+
text-overflow: ellipsis;
|
|
70
|
+
white-space: nowrap;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
2
2
|
import './index.scss';
|
|
3
3
|
import { createHash } from 'crypto';
|
|
4
4
|
const baseClass = 'lexical-unknown-diff';
|
|
@@ -17,27 +17,47 @@ export const UnknownDiffHTMLConverterAsync = ({ i18n, req })=>{
|
|
|
17
17
|
nodeTypeSpecifier = node.fields.blockType;
|
|
18
18
|
nodeType = 'InlineBlock';
|
|
19
19
|
}
|
|
20
|
-
const JSX = /*#__PURE__*/
|
|
20
|
+
const JSX = /*#__PURE__*/ _jsxDEV("div", {
|
|
21
21
|
className: `${baseClass}${providedCSSString}`,
|
|
22
22
|
"data-enable-match": "true",
|
|
23
23
|
"data-fields-hash": `${nodeFieldsHash}`,
|
|
24
24
|
children: [
|
|
25
|
-
nodeTypeSpecifier && /*#__PURE__*/
|
|
25
|
+
nodeTypeSpecifier && /*#__PURE__*/ _jsxDEV("span", {
|
|
26
26
|
className: `${baseClass}__specifier`,
|
|
27
27
|
children: [
|
|
28
28
|
nodeTypeSpecifier,
|
|
29
29
|
" "
|
|
30
30
|
]
|
|
31
|
-
}
|
|
32
|
-
|
|
31
|
+
}, void 0, true, {
|
|
32
|
+
fileName: "src/field/Diff/converters/unknown/index.tsx",
|
|
33
|
+
lineNumber: 47,
|
|
34
|
+
columnNumber: 13
|
|
35
|
+
}, this),
|
|
36
|
+
/*#__PURE__*/ _jsxDEV("span", {
|
|
33
37
|
children: nodeType
|
|
34
|
-
}
|
|
35
|
-
|
|
38
|
+
}, void 0, false, {
|
|
39
|
+
fileName: "src/field/Diff/converters/unknown/index.tsx",
|
|
40
|
+
lineNumber: 49,
|
|
41
|
+
columnNumber: 11
|
|
42
|
+
}, this),
|
|
43
|
+
/*#__PURE__*/ _jsxDEV("div", {
|
|
36
44
|
className: `${baseClass}__meta`,
|
|
37
|
-
children: /*#__PURE__*/
|
|
38
|
-
|
|
45
|
+
children: /*#__PURE__*/ _jsxDEV("br", {}, void 0, false, {
|
|
46
|
+
fileName: "src/field/Diff/converters/unknown/index.tsx",
|
|
47
|
+
lineNumber: 51,
|
|
48
|
+
columnNumber: 13
|
|
49
|
+
}, this)
|
|
50
|
+
}, void 0, false, {
|
|
51
|
+
fileName: "src/field/Diff/converters/unknown/index.tsx",
|
|
52
|
+
lineNumber: 50,
|
|
53
|
+
columnNumber: 11
|
|
54
|
+
}, this)
|
|
39
55
|
]
|
|
40
|
-
}
|
|
56
|
+
}, void 0, true, {
|
|
57
|
+
fileName: "src/field/Diff/converters/unknown/index.tsx",
|
|
58
|
+
lineNumber: 41,
|
|
59
|
+
columnNumber: 9
|
|
60
|
+
}, this);
|
|
41
61
|
// Render to HTML
|
|
42
62
|
const html = ReactDOMServer.renderToStaticMarkup(JSX);
|
|
43
63
|
return html;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/Diff/converters/unknown/index.tsx"],"sourcesContent":["import type { LexicalNode } from 'lexical'\nimport type { PayloadRequest } from 'payload'\n\nimport { type I18nClient } from '@payloadcms/translations'\n\nimport './index.scss'\n\nimport { createHash } from 'crypto'\n\nimport type { HTMLConvertersAsync } from '../../../../features/converters/lexicalToHtml/async/types.js'\nimport type { SerializedBlockNode } from '../../../../nodeTypes.js'\n\nconst baseClass = 'lexical-unknown-diff'\n\nexport const UnknownDiffHTMLConverterAsync: (args: {\n i18n: I18nClient\n req: PayloadRequest\n}) => HTMLConvertersAsync<LexicalNode> = ({ i18n, req }) => {\n return {\n unknown: async ({ node, providedCSSString }) => {\n const ReactDOMServer = (await import('react-dom/server')).default\n\n // hash fields to ensure they are diffed if they change\n const nodeFieldsHash = createHash('sha256')\n .update(JSON.stringify(node ?? {}))\n .digest('hex')\n\n let nodeType = node.type\n\n let nodeTypeSpecifier: null | string = null\n\n if (node.type === 'block') {\n nodeTypeSpecifier = (node as SerializedBlockNode).fields.blockType\n nodeType = 'Block'\n } else if (node.type === 'inlineBlock') {\n nodeTypeSpecifier = (node as SerializedBlockNode).fields.blockType\n nodeType = 'InlineBlock'\n }\n\n const JSX = (\n <div\n className={`${baseClass}${providedCSSString}`}\n data-enable-match=\"true\"\n data-fields-hash={`${nodeFieldsHash}`}\n >\n {nodeTypeSpecifier && (\n <span className={`${baseClass}__specifier`}>{nodeTypeSpecifier} </span>\n )}\n <span>{nodeType}</span>\n <div className={`${baseClass}__meta`}>\n <br />\n </div>\n </div>\n )\n\n // Render to HTML\n const html = ReactDOMServer.renderToStaticMarkup(JSX)\n\n return html\n },\n }\n}\n"],"names":["createHash","baseClass","UnknownDiffHTMLConverterAsync","i18n","req","unknown","node","providedCSSString","ReactDOMServer","default","nodeFieldsHash","update","JSON","stringify","digest","nodeType","type","nodeTypeSpecifier","fields","blockType","JSX","div","className","data-enable-match","data-fields-hash","span","br","html","renderToStaticMarkup"],"mappings":";AAKA,OAAO,eAAc;AAErB,SAASA,UAAU,QAAQ,SAAQ;AAKnC,MAAMC,YAAY;AAElB,OAAO,MAAMC,gCAG4B,CAAC,EAAEC,IAAI,EAAEC,GAAG,EAAE;IACrD,OAAO;QACLC,SAAS,OAAO,EAAEC,IAAI,EAAEC,iBAAiB,EAAE;YACzC,MAAMC,iBAAiB,AAAC,CAAA,MAAM,MAAM,CAAC,mBAAkB,EAAGC,OAAO;YAEjE,uDAAuD;YACvD,MAAMC,iBAAiBV,WAAW,UAC/BW,MAAM,CAACC,KAAKC,SAAS,CAACP,QAAQ,CAAC,IAC/BQ,MAAM,CAAC;YAEV,IAAIC,WAAWT,KAAKU,IAAI;YAExB,IAAIC,oBAAmC;YAEvC,IAAIX,KAAKU,IAAI,KAAK,SAAS;gBACzBC,oBAAoB,AAACX,KAA6BY,MAAM,CAACC,SAAS;gBAClEJ,WAAW;YACb,OAAO,IAAIT,KAAKU,IAAI,KAAK,eAAe;gBACtCC,oBAAoB,AAACX,KAA6BY,MAAM,CAACC,SAAS;gBAClEJ,WAAW;YACb;YAEA,MAAMK,oBACJ,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/Diff/converters/unknown/index.tsx"],"sourcesContent":["import type { LexicalNode } from 'lexical'\nimport type { PayloadRequest } from 'payload'\n\nimport { type I18nClient } from '@payloadcms/translations'\n\nimport './index.scss'\n\nimport { createHash } from 'crypto'\n\nimport type { HTMLConvertersAsync } from '../../../../features/converters/lexicalToHtml/async/types.js'\nimport type { SerializedBlockNode } from '../../../../nodeTypes.js'\n\nconst baseClass = 'lexical-unknown-diff'\n\nexport const UnknownDiffHTMLConverterAsync: (args: {\n i18n: I18nClient\n req: PayloadRequest\n}) => HTMLConvertersAsync<LexicalNode> = ({ i18n, req }) => {\n return {\n unknown: async ({ node, providedCSSString }) => {\n const ReactDOMServer = (await import('react-dom/server')).default\n\n // hash fields to ensure they are diffed if they change\n const nodeFieldsHash = createHash('sha256')\n .update(JSON.stringify(node ?? {}))\n .digest('hex')\n\n let nodeType = node.type\n\n let nodeTypeSpecifier: null | string = null\n\n if (node.type === 'block') {\n nodeTypeSpecifier = (node as SerializedBlockNode).fields.blockType\n nodeType = 'Block'\n } else if (node.type === 'inlineBlock') {\n nodeTypeSpecifier = (node as SerializedBlockNode).fields.blockType\n nodeType = 'InlineBlock'\n }\n\n const JSX = (\n <div\n className={`${baseClass}${providedCSSString}`}\n data-enable-match=\"true\"\n data-fields-hash={`${nodeFieldsHash}`}\n >\n {nodeTypeSpecifier && (\n <span className={`${baseClass}__specifier`}>{nodeTypeSpecifier} </span>\n )}\n <span>{nodeType}</span>\n <div className={`${baseClass}__meta`}>\n <br />\n </div>\n </div>\n )\n\n // Render to HTML\n const html = ReactDOMServer.renderToStaticMarkup(JSX)\n\n return html\n },\n }\n}\n"],"names":["createHash","baseClass","UnknownDiffHTMLConverterAsync","i18n","req","unknown","node","providedCSSString","ReactDOMServer","default","nodeFieldsHash","update","JSON","stringify","digest","nodeType","type","nodeTypeSpecifier","fields","blockType","JSX","div","className","data-enable-match","data-fields-hash","span","br","html","renderToStaticMarkup"],"mappings":";AAKA,OAAO,eAAc;AAErB,SAASA,UAAU,QAAQ,SAAQ;AAKnC,MAAMC,YAAY;AAElB,OAAO,MAAMC,gCAG4B,CAAC,EAAEC,IAAI,EAAEC,GAAG,EAAE;IACrD,OAAO;QACLC,SAAS,OAAO,EAAEC,IAAI,EAAEC,iBAAiB,EAAE;YACzC,MAAMC,iBAAiB,AAAC,CAAA,MAAM,MAAM,CAAC,mBAAkB,EAAGC,OAAO;YAEjE,uDAAuD;YACvD,MAAMC,iBAAiBV,WAAW,UAC/BW,MAAM,CAACC,KAAKC,SAAS,CAACP,QAAQ,CAAC,IAC/BQ,MAAM,CAAC;YAEV,IAAIC,WAAWT,KAAKU,IAAI;YAExB,IAAIC,oBAAmC;YAEvC,IAAIX,KAAKU,IAAI,KAAK,SAAS;gBACzBC,oBAAoB,AAACX,KAA6BY,MAAM,CAACC,SAAS;gBAClEJ,WAAW;YACb,OAAO,IAAIT,KAAKU,IAAI,KAAK,eAAe;gBACtCC,oBAAoB,AAACX,KAA6BY,MAAM,CAACC,SAAS;gBAClEJ,WAAW;YACb;YAEA,MAAMK,oBACJ,QAACC;gBACCC,WAAW,GAAGrB,YAAYM,mBAAmB;gBAC7CgB,qBAAkB;gBAClBC,oBAAkB,GAAGd,gBAAgB;;oBAEpCO,mCACC,QAACQ;wBAAKH,WAAW,GAAGrB,UAAU,WAAW,CAAC;;4BAAGgB;4BAAkB;;;;;;;kCAEjE,QAACQ;kCAAMV;;;;;;kCACP,QAACM;wBAAIC,WAAW,GAAGrB,UAAU,MAAM,CAAC;kCAClC,cAAA,QAACyB;;;;;;;;;;;;;;;;YAKP,iBAAiB;YACjB,MAAMC,OAAOnB,eAAeoB,oBAAoB,CAACR;YAEjD,OAAOO;QACT;IACF;AACF,EAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
@import '~@payloadcms/ui/scss';
|
|
2
|
+
|
|
3
|
+
@layer payload-default {
|
|
4
|
+
.lexical-diff .lexical-unknown-diff {
|
|
5
|
+
@extend %body;
|
|
6
|
+
@include shadow-sm;
|
|
7
|
+
max-width: fit-content;
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
background: var(--theme-input-bg);
|
|
11
|
+
border-radius: $style-radius-s;
|
|
12
|
+
border: 1px solid var(--theme-elevation-100);
|
|
13
|
+
position: relative;
|
|
14
|
+
font-family: var(--font-body);
|
|
15
|
+
margin-block: base(0.5);
|
|
16
|
+
max-height: calc(var(--base) * 4);
|
|
17
|
+
padding: base(0.25);
|
|
18
|
+
|
|
19
|
+
&__specifier {
|
|
20
|
+
font-family: 'SF Mono', Menlo, Consolas, Monaco, monospace;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&[data-match-type='create'] {
|
|
24
|
+
border-color: var(--diff-create-pill-border);
|
|
25
|
+
color: var(--diff-create-parent-color);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&[data-match-type='delete'] {
|
|
29
|
+
border-color: var(--diff-delete-pill-border);
|
|
30
|
+
color: var(--diff-delete-parent-color);
|
|
31
|
+
text-decoration-line: none;
|
|
32
|
+
background-color: var(--diff-delete-pill-bg);
|
|
33
|
+
|
|
34
|
+
* {
|
|
35
|
+
text-decoration-line: none;
|
|
36
|
+
color: var(--diff-delete-parent-color);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
2
2
|
import { File } from '@payloadcms/ui/rsc';
|
|
3
3
|
import { createHash } from 'crypto';
|
|
4
4
|
import './index.scss';
|
|
@@ -30,7 +30,7 @@ export const UploadDiffHTMLConverterAsync = ({ i18n, req })=>{
|
|
|
30
30
|
const ReactDOMServer = (await import('react-dom/server')).default;
|
|
31
31
|
// hash fields to ensure they are diffed if they change
|
|
32
32
|
const nodeFieldsHash = createHash('sha256').update(JSON.stringify(node.fields ?? {})).digest('hex');
|
|
33
|
-
const JSX = /*#__PURE__*/
|
|
33
|
+
const JSX = /*#__PURE__*/ _jsxDEV("div", {
|
|
34
34
|
className: `${baseClass}${providedCSSString}`,
|
|
35
35
|
"data-enable-match": "true",
|
|
36
36
|
"data-fields-hash": `${nodeFieldsHash}`,
|
|
@@ -38,48 +38,88 @@ export const UploadDiffHTMLConverterAsync = ({ i18n, req })=>{
|
|
|
38
38
|
"data-lexical-upload-id": uploadNode.value,
|
|
39
39
|
"data-lexical-upload-relation-to": uploadNode.relationTo,
|
|
40
40
|
"data-src": thumbnailSRC,
|
|
41
|
-
children: /*#__PURE__*/
|
|
41
|
+
children: /*#__PURE__*/ _jsxDEV("div", {
|
|
42
42
|
className: `${baseClass}__card`,
|
|
43
43
|
children: [
|
|
44
|
-
/*#__PURE__*/
|
|
44
|
+
/*#__PURE__*/ _jsxDEV("div", {
|
|
45
45
|
className: `${baseClass}__thumbnail`,
|
|
46
|
-
children: thumbnailSRC?.length ? /*#__PURE__*/
|
|
46
|
+
children: thumbnailSRC?.length ? /*#__PURE__*/ _jsxDEV("img", {
|
|
47
47
|
alt: uploadDoc?.filename,
|
|
48
48
|
src: thumbnailSRC
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
}, void 0, false, {
|
|
50
|
+
fileName: "src/field/Diff/converters/upload/index.tsx",
|
|
51
|
+
lineNumber: 70,
|
|
52
|
+
columnNumber: 17
|
|
53
|
+
}, this) : /*#__PURE__*/ _jsxDEV(File, {}, void 0, false, {
|
|
54
|
+
fileName: "src/field/Diff/converters/upload/index.tsx",
|
|
55
|
+
lineNumber: 72,
|
|
56
|
+
columnNumber: 17
|
|
57
|
+
}, this)
|
|
58
|
+
}, void 0, false, {
|
|
59
|
+
fileName: "src/field/Diff/converters/upload/index.tsx",
|
|
60
|
+
lineNumber: 68,
|
|
61
|
+
columnNumber: 13
|
|
62
|
+
}, this),
|
|
63
|
+
/*#__PURE__*/ _jsxDEV("div", {
|
|
52
64
|
className: `${baseClass}__info`,
|
|
53
65
|
"data-enable-match": "false",
|
|
54
66
|
children: [
|
|
55
|
-
/*#__PURE__*/
|
|
67
|
+
/*#__PURE__*/ _jsxDEV("strong", {
|
|
56
68
|
children: uploadDoc?.filename
|
|
57
|
-
}
|
|
58
|
-
|
|
69
|
+
}, void 0, false, {
|
|
70
|
+
fileName: "src/field/Diff/converters/upload/index.tsx",
|
|
71
|
+
lineNumber: 76,
|
|
72
|
+
columnNumber: 15
|
|
73
|
+
}, this),
|
|
74
|
+
/*#__PURE__*/ _jsxDEV("div", {
|
|
59
75
|
className: `${baseClass}__meta`,
|
|
60
76
|
children: [
|
|
61
77
|
formatFilesize(uploadDoc?.filesize),
|
|
62
|
-
typeof uploadDoc?.width === 'number' && typeof uploadDoc?.height === 'number' && /*#__PURE__*/
|
|
78
|
+
typeof uploadDoc?.width === 'number' && typeof uploadDoc?.height === 'number' && /*#__PURE__*/ _jsxDEV(React.Fragment, {
|
|
63
79
|
children: [
|
|
64
80
|
" - ",
|
|
65
81
|
uploadDoc?.width,
|
|
66
82
|
"x",
|
|
67
83
|
uploadDoc?.height
|
|
68
84
|
]
|
|
69
|
-
}
|
|
70
|
-
|
|
85
|
+
}, void 0, true, {
|
|
86
|
+
fileName: "src/field/Diff/converters/upload/index.tsx",
|
|
87
|
+
lineNumber: 80,
|
|
88
|
+
columnNumber: 19
|
|
89
|
+
}, this),
|
|
90
|
+
uploadDoc?.mimeType && /*#__PURE__*/ _jsxDEV(React.Fragment, {
|
|
71
91
|
children: [
|
|
72
92
|
" - ",
|
|
73
93
|
uploadDoc?.mimeType
|
|
74
94
|
]
|
|
75
|
-
}
|
|
95
|
+
}, void 0, true, {
|
|
96
|
+
fileName: "src/field/Diff/converters/upload/index.tsx",
|
|
97
|
+
lineNumber: 86,
|
|
98
|
+
columnNumber: 19
|
|
99
|
+
}, this)
|
|
76
100
|
]
|
|
77
|
-
}
|
|
101
|
+
}, void 0, true, {
|
|
102
|
+
fileName: "src/field/Diff/converters/upload/index.tsx",
|
|
103
|
+
lineNumber: 77,
|
|
104
|
+
columnNumber: 15
|
|
105
|
+
}, this)
|
|
78
106
|
]
|
|
79
|
-
}
|
|
107
|
+
}, void 0, true, {
|
|
108
|
+
fileName: "src/field/Diff/converters/upload/index.tsx",
|
|
109
|
+
lineNumber: 75,
|
|
110
|
+
columnNumber: 13
|
|
111
|
+
}, this)
|
|
80
112
|
]
|
|
81
|
-
}
|
|
82
|
-
|
|
113
|
+
}, void 0, true, {
|
|
114
|
+
fileName: "src/field/Diff/converters/upload/index.tsx",
|
|
115
|
+
lineNumber: 67,
|
|
116
|
+
columnNumber: 11
|
|
117
|
+
}, this)
|
|
118
|
+
}, void 0, false, {
|
|
119
|
+
fileName: "src/field/Diff/converters/upload/index.tsx",
|
|
120
|
+
lineNumber: 58,
|
|
121
|
+
columnNumber: 9
|
|
122
|
+
}, this);
|
|
83
123
|
// Render to HTML
|
|
84
124
|
const html = ReactDOMServer.renderToStaticMarkup(JSX);
|
|
85
125
|
return html;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/Diff/converters/upload/index.tsx"],"sourcesContent":["import type { FileData, PayloadRequest, TypeWithID } from 'payload'\n\nimport { type I18nClient } from '@payloadcms/translations'\nimport { File } from '@payloadcms/ui/rsc'\nimport { createHash } from 'crypto'\n\nimport './index.scss'\n\nimport { formatFilesize } from 'payload/shared'\nimport React from 'react'\n\nimport type { HTMLConvertersAsync } from '../../../../features/converters/lexicalToHtml/async/types.js'\nimport type { UploadDataImproved } from '../../../../features/upload/server/nodes/UploadNode.js'\nimport type { SerializedUploadNode } from '../../../../nodeTypes.js'\n\nconst baseClass = 'lexical-upload-diff'\n\nexport const UploadDiffHTMLConverterAsync: (args: {\n i18n: I18nClient\n req: PayloadRequest\n}) => HTMLConvertersAsync<SerializedUploadNode> = ({ i18n, req }) => {\n return {\n upload: async ({ node, populate, providedCSSString }) => {\n const uploadNode = node as UploadDataImproved\n\n let uploadDoc: (FileData & TypeWithID) | undefined = undefined\n\n // If there's no valid upload data, populate return an empty string\n if (typeof uploadNode.value !== 'object') {\n if (!populate) {\n return ''\n }\n uploadDoc = await populate<FileData & TypeWithID>({\n id: uploadNode.value,\n collectionSlug: uploadNode.relationTo,\n })\n } else {\n uploadDoc = uploadNode.value as unknown as FileData & TypeWithID\n }\n\n if (!uploadDoc) {\n return ''\n }\n\n const relatedCollection = req.payload.collections[uploadNode.relationTo]?.config\n\n const thumbnailSRC: string =\n ('thumbnailURL' in uploadDoc && (uploadDoc?.thumbnailURL as string)) || uploadDoc?.url || ''\n\n const ReactDOMServer = (await import('react-dom/server')).default\n\n // hash fields to ensure they are diffed if they change\n const nodeFieldsHash = createHash('sha256')\n .update(JSON.stringify(node.fields ?? {}))\n .digest('hex')\n\n const JSX = (\n <div\n className={`${baseClass}${providedCSSString}`}\n data-enable-match=\"true\"\n data-fields-hash={`${nodeFieldsHash}`}\n data-filename={uploadDoc?.filename}\n data-lexical-upload-id={uploadNode.value}\n data-lexical-upload-relation-to={uploadNode.relationTo}\n data-src={thumbnailSRC}\n >\n <div className={`${baseClass}__card`}>\n <div className={`${baseClass}__thumbnail`}>\n {thumbnailSRC?.length ? (\n <img alt={uploadDoc?.filename} src={thumbnailSRC} />\n ) : (\n <File />\n )}\n </div>\n <div className={`${baseClass}__info`} data-enable-match=\"false\">\n <strong>{uploadDoc?.filename}</strong>\n <div className={`${baseClass}__meta`}>\n {formatFilesize(uploadDoc?.filesize)}\n {typeof uploadDoc?.width === 'number' && typeof uploadDoc?.height === 'number' && (\n <React.Fragment>\n - \n {uploadDoc?.width}x{uploadDoc?.height}\n </React.Fragment>\n )}\n {uploadDoc?.mimeType && (\n <React.Fragment>\n - \n {uploadDoc?.mimeType}\n </React.Fragment>\n )}\n </div>\n </div>\n </div>\n </div>\n )\n\n // Render to HTML\n const html = ReactDOMServer.renderToStaticMarkup(JSX)\n\n return html\n },\n }\n}\n"],"names":["File","createHash","formatFilesize","React","baseClass","UploadDiffHTMLConverterAsync","i18n","req","upload","node","populate","providedCSSString","uploadNode","uploadDoc","undefined","value","id","collectionSlug","relationTo","relatedCollection","payload","collections","config","thumbnailSRC","thumbnailURL","url","ReactDOMServer","default","nodeFieldsHash","update","JSON","stringify","fields","digest","JSX","div","className","data-enable-match","data-fields-hash","data-filename","filename","data-lexical-upload-id","data-lexical-upload-relation-to","data-src","length","img","alt","src","strong","filesize","width","height","Fragment","mimeType","html","renderToStaticMarkup"],"mappings":";AAGA,SAASA,IAAI,QAAQ,qBAAoB;AACzC,SAASC,UAAU,QAAQ,SAAQ;AAEnC,OAAO,eAAc;AAErB,SAASC,cAAc,QAAQ,iBAAgB;AAC/C,OAAOC,WAAW,QAAO;AAMzB,MAAMC,YAAY;AAElB,OAAO,MAAMC,+BAGqC,CAAC,EAAEC,IAAI,EAAEC,GAAG,EAAE;IAC9D,OAAO;QACLC,QAAQ,OAAO,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,iBAAiB,EAAE;YAClD,MAAMC,aAAaH;YAEnB,IAAII,YAAiDC;YAErD,mEAAmE;YACnE,IAAI,OAAOF,WAAWG,KAAK,KAAK,UAAU;gBACxC,IAAI,CAACL,UAAU;oBACb,OAAO;gBACT;gBACAG,YAAY,MAAMH,SAAgC;oBAChDM,IAAIJ,WAAWG,KAAK;oBACpBE,gBAAgBL,WAAWM,UAAU;gBACvC;YACF,OAAO;gBACLL,YAAYD,WAAWG,KAAK;YAC9B;YAEA,IAAI,CAACF,WAAW;gBACd,OAAO;YACT;YAEA,MAAMM,oBAAoBZ,IAAIa,OAAO,CAACC,WAAW,CAACT,WAAWM,UAAU,CAAC,EAAEI;YAE1E,MAAMC,eACJ,AAAC,kBAAkBV,aAAcA,WAAWW,gBAA4BX,WAAWY,OAAO;YAE5F,MAAMC,iBAAiB,AAAC,CAAA,MAAM,MAAM,CAAC,mBAAkB,EAAGC,OAAO;YAEjE,uDAAuD;YACvD,MAAMC,iBAAiB3B,WAAW,UAC/B4B,MAAM,CAACC,KAAKC,SAAS,CAACtB,KAAKuB,MAAM,IAAI,CAAC,IACtCC,MAAM,CAAC;YAEV,MAAMC,oBACJ,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/Diff/converters/upload/index.tsx"],"sourcesContent":["import type { FileData, PayloadRequest, TypeWithID } from 'payload'\n\nimport { type I18nClient } from '@payloadcms/translations'\nimport { File } from '@payloadcms/ui/rsc'\nimport { createHash } from 'crypto'\n\nimport './index.scss'\n\nimport { formatFilesize } from 'payload/shared'\nimport React from 'react'\n\nimport type { HTMLConvertersAsync } from '../../../../features/converters/lexicalToHtml/async/types.js'\nimport type { UploadDataImproved } from '../../../../features/upload/server/nodes/UploadNode.js'\nimport type { SerializedUploadNode } from '../../../../nodeTypes.js'\n\nconst baseClass = 'lexical-upload-diff'\n\nexport const UploadDiffHTMLConverterAsync: (args: {\n i18n: I18nClient\n req: PayloadRequest\n}) => HTMLConvertersAsync<SerializedUploadNode> = ({ i18n, req }) => {\n return {\n upload: async ({ node, populate, providedCSSString }) => {\n const uploadNode = node as UploadDataImproved\n\n let uploadDoc: (FileData & TypeWithID) | undefined = undefined\n\n // If there's no valid upload data, populate return an empty string\n if (typeof uploadNode.value !== 'object') {\n if (!populate) {\n return ''\n }\n uploadDoc = await populate<FileData & TypeWithID>({\n id: uploadNode.value,\n collectionSlug: uploadNode.relationTo,\n })\n } else {\n uploadDoc = uploadNode.value as unknown as FileData & TypeWithID\n }\n\n if (!uploadDoc) {\n return ''\n }\n\n const relatedCollection = req.payload.collections[uploadNode.relationTo]?.config\n\n const thumbnailSRC: string =\n ('thumbnailURL' in uploadDoc && (uploadDoc?.thumbnailURL as string)) || uploadDoc?.url || ''\n\n const ReactDOMServer = (await import('react-dom/server')).default\n\n // hash fields to ensure they are diffed if they change\n const nodeFieldsHash = createHash('sha256')\n .update(JSON.stringify(node.fields ?? {}))\n .digest('hex')\n\n const JSX = (\n <div\n className={`${baseClass}${providedCSSString}`}\n data-enable-match=\"true\"\n data-fields-hash={`${nodeFieldsHash}`}\n data-filename={uploadDoc?.filename}\n data-lexical-upload-id={uploadNode.value}\n data-lexical-upload-relation-to={uploadNode.relationTo}\n data-src={thumbnailSRC}\n >\n <div className={`${baseClass}__card`}>\n <div className={`${baseClass}__thumbnail`}>\n {thumbnailSRC?.length ? (\n <img alt={uploadDoc?.filename} src={thumbnailSRC} />\n ) : (\n <File />\n )}\n </div>\n <div className={`${baseClass}__info`} data-enable-match=\"false\">\n <strong>{uploadDoc?.filename}</strong>\n <div className={`${baseClass}__meta`}>\n {formatFilesize(uploadDoc?.filesize)}\n {typeof uploadDoc?.width === 'number' && typeof uploadDoc?.height === 'number' && (\n <React.Fragment>\n - \n {uploadDoc?.width}x{uploadDoc?.height}\n </React.Fragment>\n )}\n {uploadDoc?.mimeType && (\n <React.Fragment>\n - \n {uploadDoc?.mimeType}\n </React.Fragment>\n )}\n </div>\n </div>\n </div>\n </div>\n )\n\n // Render to HTML\n const html = ReactDOMServer.renderToStaticMarkup(JSX)\n\n return html\n },\n }\n}\n"],"names":["File","createHash","formatFilesize","React","baseClass","UploadDiffHTMLConverterAsync","i18n","req","upload","node","populate","providedCSSString","uploadNode","uploadDoc","undefined","value","id","collectionSlug","relationTo","relatedCollection","payload","collections","config","thumbnailSRC","thumbnailURL","url","ReactDOMServer","default","nodeFieldsHash","update","JSON","stringify","fields","digest","JSX","div","className","data-enable-match","data-fields-hash","data-filename","filename","data-lexical-upload-id","data-lexical-upload-relation-to","data-src","length","img","alt","src","strong","filesize","width","height","Fragment","mimeType","html","renderToStaticMarkup"],"mappings":";AAGA,SAASA,IAAI,QAAQ,qBAAoB;AACzC,SAASC,UAAU,QAAQ,SAAQ;AAEnC,OAAO,eAAc;AAErB,SAASC,cAAc,QAAQ,iBAAgB;AAC/C,OAAOC,WAAW,QAAO;AAMzB,MAAMC,YAAY;AAElB,OAAO,MAAMC,+BAGqC,CAAC,EAAEC,IAAI,EAAEC,GAAG,EAAE;IAC9D,OAAO;QACLC,QAAQ,OAAO,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,iBAAiB,EAAE;YAClD,MAAMC,aAAaH;YAEnB,IAAII,YAAiDC;YAErD,mEAAmE;YACnE,IAAI,OAAOF,WAAWG,KAAK,KAAK,UAAU;gBACxC,IAAI,CAACL,UAAU;oBACb,OAAO;gBACT;gBACAG,YAAY,MAAMH,SAAgC;oBAChDM,IAAIJ,WAAWG,KAAK;oBACpBE,gBAAgBL,WAAWM,UAAU;gBACvC;YACF,OAAO;gBACLL,YAAYD,WAAWG,KAAK;YAC9B;YAEA,IAAI,CAACF,WAAW;gBACd,OAAO;YACT;YAEA,MAAMM,oBAAoBZ,IAAIa,OAAO,CAACC,WAAW,CAACT,WAAWM,UAAU,CAAC,EAAEI;YAE1E,MAAMC,eACJ,AAAC,kBAAkBV,aAAcA,WAAWW,gBAA4BX,WAAWY,OAAO;YAE5F,MAAMC,iBAAiB,AAAC,CAAA,MAAM,MAAM,CAAC,mBAAkB,EAAGC,OAAO;YAEjE,uDAAuD;YACvD,MAAMC,iBAAiB3B,WAAW,UAC/B4B,MAAM,CAACC,KAAKC,SAAS,CAACtB,KAAKuB,MAAM,IAAI,CAAC,IACtCC,MAAM,CAAC;YAEV,MAAMC,oBACJ,QAACC;gBACCC,WAAW,GAAGhC,YAAYO,mBAAmB;gBAC7C0B,qBAAkB;gBAClBC,oBAAkB,GAAGV,gBAAgB;gBACrCW,iBAAe1B,WAAW2B;gBAC1BC,0BAAwB7B,WAAWG,KAAK;gBACxC2B,mCAAiC9B,WAAWM,UAAU;gBACtDyB,YAAUpB;0BAEV,cAAA,QAACY;oBAAIC,WAAW,GAAGhC,UAAU,MAAM,CAAC;;sCAClC,QAAC+B;4BAAIC,WAAW,GAAGhC,UAAU,WAAW,CAAC;sCACtCmB,cAAcqB,uBACb,QAACC;gCAAIC,KAAKjC,WAAW2B;gCAAUO,KAAKxB;;;;;qDAEpC,QAACvB;;;;;;;;;;sCAGL,QAACmC;4BAAIC,WAAW,GAAGhC,UAAU,MAAM,CAAC;4BAAEiC,qBAAkB;;8CACtD,QAACW;8CAAQnC,WAAW2B;;;;;;8CACpB,QAACL;oCAAIC,WAAW,GAAGhC,UAAU,MAAM,CAAC;;wCACjCF,eAAeW,WAAWoC;wCAC1B,OAAOpC,WAAWqC,UAAU,YAAY,OAAOrC,WAAWsC,WAAW,0BACpE,QAAChD,MAAMiD,QAAQ;;gDAAC;gDAEbvC,WAAWqC;gDAAM;gDAAErC,WAAWsC;;;;;;;wCAGlCtC,WAAWwC,0BACV,QAAClD,MAAMiD,QAAQ;;gDAAC;gDAEbvC,WAAWwC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAS1B,iBAAiB;YACjB,MAAMC,OAAO5B,eAAe6B,oBAAoB,CAACrB;YAEjD,OAAOoB;QACT;IACF;AACF,EAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
@import '~@payloadcms/ui/scss';
|
|
2
|
+
|
|
3
|
+
@layer payload-default {
|
|
4
|
+
.lexical-diff {
|
|
5
|
+
.lexical-upload-diff {
|
|
6
|
+
@extend %body;
|
|
7
|
+
@include shadow-sm;
|
|
8
|
+
min-width: calc(var(--base) * 10);
|
|
9
|
+
max-width: fit-content;
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
background-color: var(--theme-input-bg);
|
|
13
|
+
border-radius: $style-radius-s;
|
|
14
|
+
border: 1px solid var(--theme-elevation-100);
|
|
15
|
+
position: relative;
|
|
16
|
+
font-family: var(--font-body);
|
|
17
|
+
margin-block: base(0.5);
|
|
18
|
+
max-height: calc(var(--base) * 3);
|
|
19
|
+
padding: base(0.6);
|
|
20
|
+
|
|
21
|
+
&[data-match-type='create'] {
|
|
22
|
+
border-color: var(--diff-create-pill-border);
|
|
23
|
+
color: var(--diff-create-parent-color);
|
|
24
|
+
|
|
25
|
+
* {
|
|
26
|
+
color: var(--diff-create-parent-color);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.lexical-upload-diff__meta {
|
|
30
|
+
color: var(--diff-create-link-color);
|
|
31
|
+
* {
|
|
32
|
+
color: var(--diff-create-link-color);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.lexical-upload-diff__thumbnail {
|
|
37
|
+
border-radius: 0px;
|
|
38
|
+
border-color: var(--diff-create-pill-border);
|
|
39
|
+
background-color: none;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&[data-match-type='delete'] {
|
|
44
|
+
border-color: var(--diff-delete-pill-border);
|
|
45
|
+
text-decoration-line: none;
|
|
46
|
+
color: var(--diff-delete-parent-color);
|
|
47
|
+
background-color: var(--diff-delete-pill-bg);
|
|
48
|
+
|
|
49
|
+
.lexical-upload-diff__meta {
|
|
50
|
+
color: var(--diff-delete-link-color);
|
|
51
|
+
* {
|
|
52
|
+
color: var(--diff-delete-link-color);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
* {
|
|
57
|
+
text-decoration-line: none;
|
|
58
|
+
color: var(--diff-delete-parent-color);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.lexical-upload-diff__thumbnail {
|
|
62
|
+
border-radius: 0px;
|
|
63
|
+
border-color: var(--diff-delete-pill-border);
|
|
64
|
+
background-color: none;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&__card {
|
|
69
|
+
display: flex;
|
|
70
|
+
flex-direction: row;
|
|
71
|
+
align-items: center;
|
|
72
|
+
width: 100%;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&__thumbnail {
|
|
76
|
+
width: calc(var(--base) * 3 - base(0.6) * 2);
|
|
77
|
+
height: calc(var(--base) * 3 - base(0.6) * 2);
|
|
78
|
+
position: relative;
|
|
79
|
+
overflow: hidden;
|
|
80
|
+
flex-shrink: 0;
|
|
81
|
+
border-radius: 0px;
|
|
82
|
+
border: 1px solid var(--theme-elevation-100);
|
|
83
|
+
|
|
84
|
+
img,
|
|
85
|
+
svg {
|
|
86
|
+
position: absolute;
|
|
87
|
+
object-fit: cover;
|
|
88
|
+
width: 100%;
|
|
89
|
+
height: 100%;
|
|
90
|
+
border-radius: 0px;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&__info {
|
|
95
|
+
flex-grow: 1;
|
|
96
|
+
display: flex;
|
|
97
|
+
align-items: flex-start;
|
|
98
|
+
flex-direction: column;
|
|
99
|
+
padding: calc(var(--base) * 0.25) calc(var(--base) * 0.75);
|
|
100
|
+
justify-content: space-between;
|
|
101
|
+
font-weight: 400;
|
|
102
|
+
|
|
103
|
+
strong {
|
|
104
|
+
font-weight: 600;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&__meta {
|
|
109
|
+
overflow: hidden;
|
|
110
|
+
text-overflow: ellipsis;
|
|
111
|
+
white-space: nowrap;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
package/dist/field/Diff/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
2
2
|
import { FieldDiffContainer, getHTMLDiffComponents } from '@payloadcms/ui/rsc';
|
|
3
3
|
import './index.scss';
|
|
4
4
|
import '../bundled.css';
|
|
@@ -52,7 +52,7 @@ export const LexicalDiffComponent = async (args)=>{
|
|
|
52
52
|
fromHTML: fromHTML?.length ? fromHTML : '<p></p>',
|
|
53
53
|
toHTML: toHTML?.length ? toHTML : '<p></p>'
|
|
54
54
|
});
|
|
55
|
-
return /*#__PURE__*/
|
|
55
|
+
return /*#__PURE__*/ _jsxDEV(FieldDiffContainer, {
|
|
56
56
|
className: baseClass,
|
|
57
57
|
From: From,
|
|
58
58
|
i18n: i18n,
|
|
@@ -62,7 +62,11 @@ export const LexicalDiffComponent = async (args)=>{
|
|
|
62
62
|
},
|
|
63
63
|
nestingLevel: nestingLevel,
|
|
64
64
|
To: To
|
|
65
|
-
}
|
|
65
|
+
}, void 0, false, {
|
|
66
|
+
fileName: "src/field/Diff/index.tsx",
|
|
67
|
+
lineNumber: 69,
|
|
68
|
+
columnNumber: 5
|
|
69
|
+
}, this);
|
|
66
70
|
};
|
|
67
71
|
|
|
68
72
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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 req,\n versionValue: valueTo,\n } = args\n\n const converters: HTMLConvertersFunctionAsync = ({ defaultConverters }) => ({\n ...defaultConverters,\n ...LinkDiffHTMLConverterAsync({}),\n ...ListItemDiffHTMLConverterAsync,\n ...UploadDiffHTMLConverterAsync({ i18n, req }),\n ...RelationshipDiffHTMLConverterAsync({ i18n, req }),\n ...UnknownDiffHTMLConverterAsync({ i18n, req }),\n })\n\n const payloadPopulateFn = await getPayloadPopulateFn({\n currentDepth: 0,\n depth: 1,\n 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 // Ensure empty paragraph is displayed for empty rich text fields - otherwise, toHTML may be displayed in the wrong column\n fromHTML: fromHTML?.length ? fromHTML : '<p></p>',\n toHTML: toHTML?.length ? toHTML : '<p></p>',\n })\n\n return (\n <FieldDiffContainer\n className={baseClass}\n From={From}\n i18n={i18n}\n label={{\n label: field.label,\n locale,\n }}\n nestingLevel={nestingLevel}\n To={To}\n />\n )\n}\n"],"names":["FieldDiffContainer","getHTMLDiffComponents","React","convertLexicalToHTMLAsync","getPayloadPopulateFn","LinkDiffHTMLConverterAsync","ListItemDiffHTMLConverterAsync","RelationshipDiffHTMLConverterAsync","UnknownDiffHTMLConverterAsync","UploadDiffHTMLConverterAsync","baseClass","LexicalDiffComponent","args","comparisonValue","valueFrom","field","i18n","locale","nestingLevel","req","versionValue","valueTo","converters","defaultConverters","payloadPopulateFn","currentDepth","depth","fromHTML","data","disableContainer","populate","toHTML","From","To","length","className","label"],"mappings":";AAGA,SAASA,kBAAkB,EAAEC,qBAAqB,QAAQ,qBAAoB;AAE9E,OAAO,eAAc;AACrB,OAAO,iBAAgB;AAEvB,OAAOC,WAAW,QAAO;AAIzB,SAASC,yBAAyB,QAAQ,yDAAwD;AAClG,SAASC,oBAAoB,QAAQ,2DAA0D;AAC/F,SAASC,0BAA0B,QAAQ,uBAAsB;AACjE,SAASC,8BAA8B,QAAQ,iCAAgC;AAC/E,SAASC,kCAAkC,QAAQ,qCAAoC;AACvF,SAASC,6BAA6B,QAAQ,gCAA+B;AAC7E,SAASC,4BAA4B,QAAQ,+BAA8B;AAE3E,MAAMC,YAAY;AAElB,OAAO,MAAMC,uBAAyD,OAAOC;IAC3E,MAAM,EACJC,iBAAiBC,SAAS,EAC1BC,KAAK,EACLC,IAAI,EACJC,MAAM,EACNC,YAAY,EACZC,GAAG,EACHC,cAAcC,OAAO,EACtB,GAAGT;IAEJ,MAAMU,aAA0C,CAAC,EAAEC,iBAAiB,EAAE,GAAM,CAAA;YAC1E,GAAGA,iBAAiB;YACpB,GAAGlB,2BAA2B,CAAC,EAAE;YACjC,GAAGC,8BAA8B;YACjC,GAAGG,6BAA6B;gBAAEO;gBAAMG;YAAI,EAAE;YAC9C,GAAGZ,mCAAmC;gBAAES;gBAAMG;YAAI,EAAE;YACpD,GAAGX,8BAA8B;gBAAEQ;gBAAMG;YAAI,EAAE;QACjD,CAAA;IAEA,MAAMK,oBAAoB,MAAMpB,qBAAqB;QACnDqB,cAAc;QACdC,OAAO;QACPP;IACF;IACA,MAAMQ,WAAW,MAAMxB,0BAA0B;QAC/CmB;QACAM,MAAMd;QACNe,kBAAkB;QAClBC,UAAUN;IACZ;IAEA,MAAMO,SAAS,MAAM5B,0BAA0B;QAC7CmB;QACAM,MAAMP;QACNQ,kBAAkB;QAClBC,UAAUN;IACZ;IAEA,MAAM,EAAEQ,IAAI,EAAEC,EAAE,EAAE,GAAGhC,sBAAsB;QACzC,0HAA0H;QAC1H0B,UAAUA,UAAUO,SAASP,WAAW;QACxCI,QAAQA,QAAQG,SAASH,SAAS;IACpC;IAEA,qBACE,
|
|
1
|
+
{"version":3,"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 req,\n versionValue: valueTo,\n } = args\n\n const converters: HTMLConvertersFunctionAsync = ({ defaultConverters }) => ({\n ...defaultConverters,\n ...LinkDiffHTMLConverterAsync({}),\n ...ListItemDiffHTMLConverterAsync,\n ...UploadDiffHTMLConverterAsync({ i18n, req }),\n ...RelationshipDiffHTMLConverterAsync({ i18n, req }),\n ...UnknownDiffHTMLConverterAsync({ i18n, req }),\n })\n\n const payloadPopulateFn = await getPayloadPopulateFn({\n currentDepth: 0,\n depth: 1,\n 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 // Ensure empty paragraph is displayed for empty rich text fields - otherwise, toHTML may be displayed in the wrong column\n fromHTML: fromHTML?.length ? fromHTML : '<p></p>',\n toHTML: toHTML?.length ? toHTML : '<p></p>',\n })\n\n return (\n <FieldDiffContainer\n className={baseClass}\n From={From}\n i18n={i18n}\n label={{\n label: field.label,\n locale,\n }}\n nestingLevel={nestingLevel}\n To={To}\n />\n )\n}\n"],"names":["FieldDiffContainer","getHTMLDiffComponents","React","convertLexicalToHTMLAsync","getPayloadPopulateFn","LinkDiffHTMLConverterAsync","ListItemDiffHTMLConverterAsync","RelationshipDiffHTMLConverterAsync","UnknownDiffHTMLConverterAsync","UploadDiffHTMLConverterAsync","baseClass","LexicalDiffComponent","args","comparisonValue","valueFrom","field","i18n","locale","nestingLevel","req","versionValue","valueTo","converters","defaultConverters","payloadPopulateFn","currentDepth","depth","fromHTML","data","disableContainer","populate","toHTML","From","To","length","className","label"],"mappings":";AAGA,SAASA,kBAAkB,EAAEC,qBAAqB,QAAQ,qBAAoB;AAE9E,OAAO,eAAc;AACrB,OAAO,iBAAgB;AAEvB,OAAOC,WAAW,QAAO;AAIzB,SAASC,yBAAyB,QAAQ,yDAAwD;AAClG,SAASC,oBAAoB,QAAQ,2DAA0D;AAC/F,SAASC,0BAA0B,QAAQ,uBAAsB;AACjE,SAASC,8BAA8B,QAAQ,iCAAgC;AAC/E,SAASC,kCAAkC,QAAQ,qCAAoC;AACvF,SAASC,6BAA6B,QAAQ,gCAA+B;AAC7E,SAASC,4BAA4B,QAAQ,+BAA8B;AAE3E,MAAMC,YAAY;AAElB,OAAO,MAAMC,uBAAyD,OAAOC;IAC3E,MAAM,EACJC,iBAAiBC,SAAS,EAC1BC,KAAK,EACLC,IAAI,EACJC,MAAM,EACNC,YAAY,EACZC,GAAG,EACHC,cAAcC,OAAO,EACtB,GAAGT;IAEJ,MAAMU,aAA0C,CAAC,EAAEC,iBAAiB,EAAE,GAAM,CAAA;YAC1E,GAAGA,iBAAiB;YACpB,GAAGlB,2BAA2B,CAAC,EAAE;YACjC,GAAGC,8BAA8B;YACjC,GAAGG,6BAA6B;gBAAEO;gBAAMG;YAAI,EAAE;YAC9C,GAAGZ,mCAAmC;gBAAES;gBAAMG;YAAI,EAAE;YACpD,GAAGX,8BAA8B;gBAAEQ;gBAAMG;YAAI,EAAE;QACjD,CAAA;IAEA,MAAMK,oBAAoB,MAAMpB,qBAAqB;QACnDqB,cAAc;QACdC,OAAO;QACPP;IACF;IACA,MAAMQ,WAAW,MAAMxB,0BAA0B;QAC/CmB;QACAM,MAAMd;QACNe,kBAAkB;QAClBC,UAAUN;IACZ;IAEA,MAAMO,SAAS,MAAM5B,0BAA0B;QAC7CmB;QACAM,MAAMP;QACNQ,kBAAkB;QAClBC,UAAUN;IACZ;IAEA,MAAM,EAAEQ,IAAI,EAAEC,EAAE,EAAE,GAAGhC,sBAAsB;QACzC,0HAA0H;QAC1H0B,UAAUA,UAAUO,SAASP,WAAW;QACxCI,QAAQA,QAAQG,SAASH,SAAS;IACpC;IAEA,qBACE,QAAC/B;QACCmC,WAAWzB;QACXsB,MAAMA;QACNhB,MAAMA;QACNoB,OAAO;YACLA,OAAOrB,MAAMqB,KAAK;YAClBnB;QACF;QACAC,cAAcA;QACde,IAAIA;;;;;;AAGV,EAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
@import '~@payloadcms/ui/scss';
|
|
2
|
+
|
|
3
|
+
@layer payload-default {
|
|
4
|
+
.lexical-diff .field-diff-content {
|
|
5
|
+
.html-diff {
|
|
6
|
+
font-family: var(--font-serif);
|
|
7
|
+
font-size: base(0.8);
|
|
8
|
+
letter-spacing: 0.02em;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
blockquote {
|
|
12
|
+
font-size: base(0.8);
|
|
13
|
+
margin-block: base(0.8);
|
|
14
|
+
margin-inline: 0;
|
|
15
|
+
padding-inline-start: base(0.6);
|
|
16
|
+
padding-block: base(0.2);
|
|
17
|
+
position: relative; // Required for absolute positioning of ::after
|
|
18
|
+
|
|
19
|
+
&::after {
|
|
20
|
+
content: '';
|
|
21
|
+
position: absolute;
|
|
22
|
+
top: 0;
|
|
23
|
+
bottom: 0;
|
|
24
|
+
inset-inline-start: 0;
|
|
25
|
+
width: base(0.2);
|
|
26
|
+
background-color: var(--theme-elevation-150);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&:has([data-match-type='create'])::after {
|
|
30
|
+
background-color: var(--theme-success-150);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&:has([data-match-type='delete'])::after {
|
|
34
|
+
background-color: var(--theme-error-150);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
a {
|
|
39
|
+
border-bottom: 1px dotted;
|
|
40
|
+
text-decoration: none;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
h1 {
|
|
44
|
+
padding: base(0.7) 0px base(0.55);
|
|
45
|
+
line-height: base(1.5);
|
|
46
|
+
font-weight: 600;
|
|
47
|
+
font-size: base(1.4);
|
|
48
|
+
font-family: var(--font-body);
|
|
49
|
+
}
|
|
50
|
+
h2 {
|
|
51
|
+
padding: base(0.7) 0px base(0.5);
|
|
52
|
+
line-height: base(1.4);
|
|
53
|
+
font-weight: 600;
|
|
54
|
+
font-size: base(1.25);
|
|
55
|
+
font-family: var(--font-body);
|
|
56
|
+
}
|
|
57
|
+
h3 {
|
|
58
|
+
padding: base(0.6) 0px base(0.45);
|
|
59
|
+
line-height: base(1.4);
|
|
60
|
+
font-weight: 600;
|
|
61
|
+
font-size: base(1.1);
|
|
62
|
+
font-family: var(--font-body);
|
|
63
|
+
}
|
|
64
|
+
h4 {
|
|
65
|
+
padding: base(0.4) 0px base(0.35);
|
|
66
|
+
line-height: base(1.5);
|
|
67
|
+
font-weight: 600;
|
|
68
|
+
font-size: base(1.05);
|
|
69
|
+
font-family: var(--font-body);
|
|
70
|
+
}
|
|
71
|
+
h5 {
|
|
72
|
+
padding: base(0.3) 0px base(0.3);
|
|
73
|
+
line-height: base(1.4);
|
|
74
|
+
font-weight: 600;
|
|
75
|
+
font-size: base(0.9);
|
|
76
|
+
font-family: var(--font-body);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
h6 {
|
|
80
|
+
padding: base(0.55) 0px base(0.25);
|
|
81
|
+
line-height: base(0.5);
|
|
82
|
+
font-weight: 600;
|
|
83
|
+
font-size: base(0.75);
|
|
84
|
+
font-family: var(--font-body);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
p {
|
|
88
|
+
padding: base(0.4) 0 base(0.4);
|
|
89
|
+
|
|
90
|
+
// First paraagraph has no top padding
|
|
91
|
+
&:first-child {
|
|
92
|
+
padding: 0 0 base(0.4);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
ul,
|
|
97
|
+
ol {
|
|
98
|
+
padding-top: base(0.4);
|
|
99
|
+
padding-bottom: base(0.4);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|