@payloadcms/richtext-lexical 3.68.0-internal-debug.2eb12b9 → 3.68.0-internal-debug.dafc24d
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 +124 -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 +118 -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/markdown/markdownTransformer.js +1 -0
- package/dist/features/blocks/client/markdown/markdownTransformer.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 +88 -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 +13 -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 +19 -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/blocks/server/markdown/markdownTransformer.js +1 -0
- package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -1
- 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 +14 -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 +62 -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 +8 -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 +225 -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 +32 -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 +26 -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.js +1 -0
- package/dist/features/horizontalRule/client/plugin/index.js.map +1 -1
- 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/autoLink/index.js +3 -0
- package/dist/features/link/client/plugins/autoLink/index.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 +8 -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/link/server/baseFields.js +1 -0
- package/dist/features/link/server/baseFields.js.map +1 -1
- 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 +14 -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 +14 -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 +56 -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 +72 -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 +72 -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 +8 -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 +37 -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 +92 -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 +14 -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 +37 -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 +37 -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 +31 -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 +60 -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 +8 -3
- package/dist/field/Diff/index.js.map +1 -1
- package/dist/field/Diff/index.scss +102 -0
- package/dist/field/Field.js +81 -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/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lexical/EditorPlugin.js +13 -5
- package/dist/lexical/EditorPlugin.js.map +1 -1
- package/dist/lexical/LexicalEditor.js +163 -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.js +1 -0
- package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/DecoratorPlugin/index.scss +13 -0
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +20 -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/LexicalMenu.js +2 -0
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
- 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 +50 -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 +20 -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 +32 -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 +14 -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/packages/@lexical/markdown/MarkdownShortcuts.js +2 -0
- package/dist/packages/@lexical/markdown/MarkdownShortcuts.js.map +1 -1
- package/dist/packages/@lexical/markdown/importTextFormatTransformer.js +2 -0
- package/dist/packages/@lexical/markdown/importTextFormatTransformer.js.map +1 -1
- package/dist/packages/@lexical/markdown/importTextMatchTransformer.js +2 -0
- package/dist/packages/@lexical/markdown/importTextMatchTransformer.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/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js +2 -0
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js.map +1 -1
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +2 -0
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
- package/package.json +8 -7
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
2
2
|
import { CheckIcon } from '@payloadcms/ui/rsc';
|
|
3
|
+
import './index.scss';
|
|
3
4
|
export const ListItemDiffHTMLConverterAsync = {
|
|
4
5
|
listitem: async ({ node, nodesToHTML, parent, providedCSSString })=>{
|
|
5
6
|
const hasSubLists = node.children.some((child)=>child.type === 'list');
|
|
@@ -8,7 +9,7 @@ export const ListItemDiffHTMLConverterAsync = {
|
|
|
8
9
|
})).join('');
|
|
9
10
|
if ('listType' in parent && parent?.listType === 'check') {
|
|
10
11
|
const ReactDOMServer = (await import('react-dom/server')).default;
|
|
11
|
-
const JSX = /*#__PURE__*/
|
|
12
|
+
const JSX = /*#__PURE__*/ _jsxDEV("li", {
|
|
12
13
|
"aria-checked": node.checked ? true : false,
|
|
13
14
|
className: `checkboxItem ${node.checked ? 'checkboxItem--checked' : 'checkboxItem--unchecked'}${hasSubLists ? ' checkboxItem--nested' : ''}`,
|
|
14
15
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role
|
|
@@ -16,27 +17,51 @@ export const ListItemDiffHTMLConverterAsync = {
|
|
|
16
17
|
tabIndex: -1,
|
|
17
18
|
value: node.value,
|
|
18
19
|
children: hasSubLists ? // When sublists exist, just render them safely as HTML
|
|
19
|
-
/*#__PURE__*/
|
|
20
|
+
/*#__PURE__*/ _jsxDEV("div", {
|
|
20
21
|
dangerouslySetInnerHTML: {
|
|
21
22
|
__html: children
|
|
22
23
|
}
|
|
23
|
-
}
|
|
24
|
-
|
|
24
|
+
}, void 0, false, {
|
|
25
|
+
fileName: "src/field/Diff/converters/listitem/index.tsx",
|
|
26
|
+
lineNumber: 34,
|
|
27
|
+
columnNumber: 13
|
|
28
|
+
}, this) : // Otherwise, show our custom styled checkbox
|
|
29
|
+
/*#__PURE__*/ _jsxDEV("div", {
|
|
25
30
|
className: "checkboxItem__wrapper",
|
|
26
31
|
children: [
|
|
27
|
-
/*#__PURE__*/
|
|
32
|
+
/*#__PURE__*/ _jsxDEV("div", {
|
|
28
33
|
className: "checkboxItem__icon",
|
|
29
34
|
"data-checked": node.checked,
|
|
30
35
|
"data-enable-match": "true",
|
|
31
|
-
children: node.checked && /*#__PURE__*/
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
children: node.checked && /*#__PURE__*/ _jsxDEV(CheckIcon, {}, void 0, false, {
|
|
37
|
+
fileName: "src/field/Diff/converters/listitem/index.tsx",
|
|
38
|
+
lineNumber: 43,
|
|
39
|
+
columnNumber: 34
|
|
40
|
+
}, this)
|
|
41
|
+
}, void 0, false, {
|
|
42
|
+
fileName: "src/field/Diff/converters/listitem/index.tsx",
|
|
43
|
+
lineNumber: 38,
|
|
44
|
+
columnNumber: 15
|
|
45
|
+
}, this),
|
|
46
|
+
/*#__PURE__*/ _jsxDEV("span", {
|
|
34
47
|
className: "checkboxItem__label",
|
|
35
48
|
children: children
|
|
36
|
-
}
|
|
49
|
+
}, void 0, false, {
|
|
50
|
+
fileName: "src/field/Diff/converters/listitem/index.tsx",
|
|
51
|
+
lineNumber: 45,
|
|
52
|
+
columnNumber: 15
|
|
53
|
+
}, this)
|
|
37
54
|
]
|
|
38
|
-
}
|
|
39
|
-
|
|
55
|
+
}, void 0, true, {
|
|
56
|
+
fileName: "src/field/Diff/converters/listitem/index.tsx",
|
|
57
|
+
lineNumber: 37,
|
|
58
|
+
columnNumber: 13
|
|
59
|
+
}, this)
|
|
60
|
+
}, void 0, false, {
|
|
61
|
+
fileName: "src/field/Diff/converters/listitem/index.tsx",
|
|
62
|
+
lineNumber: 22,
|
|
63
|
+
columnNumber: 9
|
|
64
|
+
}, this);
|
|
40
65
|
const html = ReactDOMServer.renderToStaticMarkup(JSX);
|
|
41
66
|
// Add style="list-style-type: none;${providedCSSString}" to html
|
|
42
67
|
const styleIndex = html.indexOf('class="list-item-checkbox');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/Diff/converters/listitem/index.tsx"],"sourcesContent":["import { CheckIcon } from '@payloadcms/ui/rsc'\n\nimport type { HTMLConvertersAsync } from '../../../../features/converters/lexicalToHtml/async/types.js'\nimport type { SerializedListItemNode } from '../../../../nodeTypes.js'\n\nimport './index.scss'\n\nexport const ListItemDiffHTMLConverterAsync: HTMLConvertersAsync<SerializedListItemNode> = {\n listitem: async ({ node, nodesToHTML, parent, providedCSSString }) => {\n const hasSubLists = node.children.some((child) => child.type === 'list')\n\n const children = (\n await nodesToHTML({\n nodes: node.children,\n })\n ).join('')\n\n if ('listType' in parent && parent?.listType === 'check') {\n const ReactDOMServer = (await import('react-dom/server')).default\n\n const JSX = (\n <li\n aria-checked={node.checked ? true : false}\n className={`checkboxItem ${node.checked ? 'checkboxItem--checked' : 'checkboxItem--unchecked'}${\n hasSubLists ? ' checkboxItem--nested' : ''\n }`}\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role\n role=\"checkbox\"\n tabIndex={-1}\n value={node.value}\n >\n {hasSubLists ? (\n // When sublists exist, just render them safely as HTML\n <div dangerouslySetInnerHTML={{ __html: children }} />\n ) : (\n // Otherwise, show our custom styled checkbox\n <div className=\"checkboxItem__wrapper\">\n <div\n className=\"checkboxItem__icon\"\n data-checked={node.checked}\n data-enable-match=\"true\"\n >\n {node.checked && <CheckIcon />}\n </div>\n <span className=\"checkboxItem__label\">{children}</span>\n </div>\n )}\n </li>\n )\n\n const html = ReactDOMServer.renderToStaticMarkup(JSX)\n\n // Add style=\"list-style-type: none;${providedCSSString}\" to html\n const styleIndex = html.indexOf('class=\"list-item-checkbox')\n const classIndex = html.indexOf('class=\"list-item-checkbox', styleIndex)\n const classEndIndex = html.indexOf('\"', classIndex + 6)\n const className = html.substring(classIndex, classEndIndex)\n const classNameWithStyle = `${className} style=\"list-style-type: none;${providedCSSString}\"`\n const htmlWithStyle = html.replace(className, classNameWithStyle)\n\n return htmlWithStyle\n } else {\n return `<li\n class=\"${hasSubLists ? 'nestedListItem' : ''}\"\n style=\"${hasSubLists ? `list-style-type: none;${providedCSSString}` : providedCSSString}\"\n value=\"${node.value}\"\n data-enable-match=\"true\"\n >${children}</li>`\n }\n },\n}\n"],"names":["CheckIcon","ListItemDiffHTMLConverterAsync","listitem","node","nodesToHTML","parent","providedCSSString","hasSubLists","children","some","child","type","nodes","join","listType","ReactDOMServer","default","JSX","li","aria-checked","checked","className","role","tabIndex","value","div","dangerouslySetInnerHTML","__html","data-checked","data-enable-match","span","html","renderToStaticMarkup","styleIndex","indexOf","classIndex","classEndIndex","substring","classNameWithStyle","htmlWithStyle","replace"],"mappings":";AAAA,SAASA,SAAS,QAAQ,qBAAoB;
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/Diff/converters/listitem/index.tsx"],"sourcesContent":["import { CheckIcon } from '@payloadcms/ui/rsc'\n\nimport type { HTMLConvertersAsync } from '../../../../features/converters/lexicalToHtml/async/types.js'\nimport type { SerializedListItemNode } from '../../../../nodeTypes.js'\n\nimport './index.scss'\n\nexport const ListItemDiffHTMLConverterAsync: HTMLConvertersAsync<SerializedListItemNode> = {\n listitem: async ({ node, nodesToHTML, parent, providedCSSString }) => {\n const hasSubLists = node.children.some((child) => child.type === 'list')\n\n const children = (\n await nodesToHTML({\n nodes: node.children,\n })\n ).join('')\n\n if ('listType' in parent && parent?.listType === 'check') {\n const ReactDOMServer = (await import('react-dom/server')).default\n\n const JSX = (\n <li\n aria-checked={node.checked ? true : false}\n className={`checkboxItem ${node.checked ? 'checkboxItem--checked' : 'checkboxItem--unchecked'}${\n hasSubLists ? ' checkboxItem--nested' : ''\n }`}\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role\n role=\"checkbox\"\n tabIndex={-1}\n value={node.value}\n >\n {hasSubLists ? (\n // When sublists exist, just render them safely as HTML\n <div dangerouslySetInnerHTML={{ __html: children }} />\n ) : (\n // Otherwise, show our custom styled checkbox\n <div className=\"checkboxItem__wrapper\">\n <div\n className=\"checkboxItem__icon\"\n data-checked={node.checked}\n data-enable-match=\"true\"\n >\n {node.checked && <CheckIcon />}\n </div>\n <span className=\"checkboxItem__label\">{children}</span>\n </div>\n )}\n </li>\n )\n\n const html = ReactDOMServer.renderToStaticMarkup(JSX)\n\n // Add style=\"list-style-type: none;${providedCSSString}\" to html\n const styleIndex = html.indexOf('class=\"list-item-checkbox')\n const classIndex = html.indexOf('class=\"list-item-checkbox', styleIndex)\n const classEndIndex = html.indexOf('\"', classIndex + 6)\n const className = html.substring(classIndex, classEndIndex)\n const classNameWithStyle = `${className} style=\"list-style-type: none;${providedCSSString}\"`\n const htmlWithStyle = html.replace(className, classNameWithStyle)\n\n return htmlWithStyle\n } else {\n return `<li\n class=\"${hasSubLists ? 'nestedListItem' : ''}\"\n style=\"${hasSubLists ? `list-style-type: none;${providedCSSString}` : providedCSSString}\"\n value=\"${node.value}\"\n data-enable-match=\"true\"\n >${children}</li>`\n }\n },\n}\n"],"names":["CheckIcon","ListItemDiffHTMLConverterAsync","listitem","node","nodesToHTML","parent","providedCSSString","hasSubLists","children","some","child","type","nodes","join","listType","ReactDOMServer","default","JSX","li","aria-checked","checked","className","role","tabIndex","value","div","dangerouslySetInnerHTML","__html","data-checked","data-enable-match","span","html","renderToStaticMarkup","styleIndex","indexOf","classIndex","classEndIndex","substring","classNameWithStyle","htmlWithStyle","replace"],"mappings":";AAAA,SAASA,SAAS,QAAQ,qBAAoB;AAK9C,OAAO,eAAc;AAErB,OAAO,MAAMC,iCAA8E;IACzFC,UAAU,OAAO,EAAEC,IAAI,EAAEC,WAAW,EAAEC,MAAM,EAAEC,iBAAiB,EAAE;QAC/D,MAAMC,cAAcJ,KAAKK,QAAQ,CAACC,IAAI,CAAC,CAACC,QAAUA,MAAMC,IAAI,KAAK;QAEjE,MAAMH,WAAW,AACf,CAAA,MAAMJ,YAAY;YAChBQ,OAAOT,KAAKK,QAAQ;QACtB,EAAC,EACDK,IAAI,CAAC;QAEP,IAAI,cAAcR,UAAUA,QAAQS,aAAa,SAAS;YACxD,MAAMC,iBAAiB,AAAC,CAAA,MAAM,MAAM,CAAC,mBAAkB,EAAGC,OAAO;YAEjE,MAAMC,oBACJ,QAACC;gBACCC,gBAAchB,KAAKiB,OAAO,GAAG,OAAO;gBACpCC,WAAW,CAAC,aAAa,EAAElB,KAAKiB,OAAO,GAAG,0BAA0B,4BAClEb,cAAc,0BAA0B,IACxC;gBACF,kFAAkF;gBAClFe,MAAK;gBACLC,UAAU,CAAC;gBACXC,OAAOrB,KAAKqB,KAAK;0BAEhBjB,cACC,uDAAuD;8BACvD,QAACkB;oBAAIC,yBAAyB;wBAAEC,QAAQnB;oBAAS;;;;;2BAEjD,6CAA6C;8BAC7C,QAACiB;oBAAIJ,WAAU;;sCACb,QAACI;4BACCJ,WAAU;4BACVO,gBAAczB,KAAKiB,OAAO;4BAC1BS,qBAAkB;sCAEjB1B,KAAKiB,OAAO,kBAAI,QAACpB;;;;;;;;;;sCAEpB,QAAC8B;4BAAKT,WAAU;sCAAuBb;;;;;;;;;;;;;;;;;YAM/C,MAAMuB,OAAOhB,eAAeiB,oBAAoB,CAACf;YAEjD,iEAAiE;YACjE,MAAMgB,aAAaF,KAAKG,OAAO,CAAC;YAChC,MAAMC,aAAaJ,KAAKG,OAAO,CAAC,6BAA6BD;YAC7D,MAAMG,gBAAgBL,KAAKG,OAAO,CAAC,KAAKC,aAAa;YACrD,MAAMd,YAAYU,KAAKM,SAAS,CAACF,YAAYC;YAC7C,MAAME,qBAAqB,GAAGjB,UAAU,8BAA8B,EAAEf,kBAAkB,CAAC,CAAC;YAC5F,MAAMiC,gBAAgBR,KAAKS,OAAO,CAACnB,WAAWiB;YAE9C,OAAOC;QACT,OAAO;YACL,OAAO,CAAC;iBACG,EAAEhC,cAAc,mBAAmB,GAAG;iBACtC,EAAEA,cAAc,CAAC,sBAAsB,EAAED,mBAAmB,GAAGA,kBAAkB;iBACjF,EAAEH,KAAKqB,KAAK,CAAC;;SAErB,EAAEhB,SAAS,KAAK,CAAC;QACtB;IACF;AACF,EAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
@import '~@payloadcms/ui/scss';
|
|
2
|
+
|
|
3
|
+
@layer payload-default {
|
|
4
|
+
.lexical-diff {
|
|
5
|
+
ul.list-check {
|
|
6
|
+
padding-left: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.checkboxItem {
|
|
10
|
+
list-style-type: none;
|
|
11
|
+
|
|
12
|
+
&__wrapper {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&__icon {
|
|
18
|
+
width: 16px;
|
|
19
|
+
height: 16px;
|
|
20
|
+
margin-right: 8px; // Spacing before label text
|
|
21
|
+
border: 1px solid var(--theme-text);
|
|
22
|
+
border-radius: 3px;
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
// Because the checkbox is non-interactive:
|
|
27
|
+
pointer-events: none;
|
|
28
|
+
|
|
29
|
+
.icon--check {
|
|
30
|
+
height: 11px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&[data-match-type='create'] {
|
|
34
|
+
border-color: var(--diff-create-pill-color);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&[data-match-type='delete'] {
|
|
38
|
+
border-color: var(--diff-delete-pill-color);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&--nested {
|
|
43
|
+
margin-left: 1.5rem;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
2
2
|
import { getTranslation } from '@payloadcms/translations';
|
|
3
|
+
import './index.scss';
|
|
3
4
|
import { formatAdminURL } from 'payload/shared';
|
|
4
5
|
const baseClass = 'lexical-relationship-diff';
|
|
5
6
|
export const RelationshipDiffHTMLConverterAsync = ({ i18n, req })=>{
|
|
@@ -21,24 +22,28 @@ export const RelationshipDiffHTMLConverterAsync = ({ i18n, req })=>{
|
|
|
21
22
|
}
|
|
22
23
|
const relatedCollection = req.payload.collections[node.relationTo]?.config;
|
|
23
24
|
const ReactDOMServer = (await import('react-dom/server')).default;
|
|
24
|
-
const JSX = /*#__PURE__*/
|
|
25
|
+
const JSX = /*#__PURE__*/ _jsxDEV("div", {
|
|
25
26
|
className: `${baseClass}${providedCSSString}`,
|
|
26
27
|
"data-enable-match": "true",
|
|
27
28
|
"data-id": id,
|
|
28
29
|
"data-slug": node.relationTo,
|
|
29
|
-
children: /*#__PURE__*/
|
|
30
|
+
children: /*#__PURE__*/ _jsxDEV("div", {
|
|
30
31
|
className: `${baseClass}__card`,
|
|
31
32
|
children: [
|
|
32
|
-
/*#__PURE__*/
|
|
33
|
+
/*#__PURE__*/ _jsxDEV("div", {
|
|
33
34
|
className: `${baseClass}__collectionLabel`,
|
|
34
35
|
children: i18n.t('fields:labelRelationship', {
|
|
35
36
|
label: relatedCollection?.labels?.singular ? getTranslation(relatedCollection?.labels?.singular, i18n) : relatedCollection?.slug
|
|
36
37
|
})
|
|
37
|
-
}
|
|
38
|
-
|
|
38
|
+
}, void 0, false, {
|
|
39
|
+
fileName: "src/field/Diff/converters/relationship/index.tsx",
|
|
40
|
+
lineNumber: 49,
|
|
41
|
+
columnNumber: 13
|
|
42
|
+
}, this),
|
|
43
|
+
data && relatedCollection?.admin?.useAsTitle && data[relatedCollection.admin.useAsTitle] ? /*#__PURE__*/ _jsxDEV("strong", {
|
|
39
44
|
className: `${baseClass}__title`,
|
|
40
45
|
"data-enable-match": "false",
|
|
41
|
-
children: /*#__PURE__*/
|
|
46
|
+
children: /*#__PURE__*/ _jsxDEV("a", {
|
|
42
47
|
className: `${baseClass}__link`,
|
|
43
48
|
"data-enable-match": "false",
|
|
44
49
|
href: formatAdminURL({
|
|
@@ -49,13 +54,33 @@ export const RelationshipDiffHTMLConverterAsync = ({ i18n, req })=>{
|
|
|
49
54
|
rel: "noopener noreferrer",
|
|
50
55
|
target: "_blank",
|
|
51
56
|
children: data[relatedCollection.admin.useAsTitle]
|
|
52
|
-
}
|
|
53
|
-
|
|
57
|
+
}, void 0, false, {
|
|
58
|
+
fileName: "src/field/Diff/converters/relationship/index.tsx",
|
|
59
|
+
lineNumber: 60,
|
|
60
|
+
columnNumber: 17
|
|
61
|
+
}, this)
|
|
62
|
+
}, void 0, false, {
|
|
63
|
+
fileName: "src/field/Diff/converters/relationship/index.tsx",
|
|
64
|
+
lineNumber: 59,
|
|
65
|
+
columnNumber: 15
|
|
66
|
+
}, this) : /*#__PURE__*/ _jsxDEV("strong", {
|
|
54
67
|
children: id
|
|
55
|
-
}
|
|
68
|
+
}, void 0, false, {
|
|
69
|
+
fileName: "src/field/Diff/converters/relationship/index.tsx",
|
|
70
|
+
lineNumber: 75,
|
|
71
|
+
columnNumber: 15
|
|
72
|
+
}, this)
|
|
56
73
|
]
|
|
57
|
-
}
|
|
58
|
-
|
|
74
|
+
}, void 0, true, {
|
|
75
|
+
fileName: "src/field/Diff/converters/relationship/index.tsx",
|
|
76
|
+
lineNumber: 48,
|
|
77
|
+
columnNumber: 11
|
|
78
|
+
}, this)
|
|
79
|
+
}, void 0, false, {
|
|
80
|
+
fileName: "src/field/Diff/converters/relationship/index.tsx",
|
|
81
|
+
lineNumber: 42,
|
|
82
|
+
columnNumber: 9
|
|
83
|
+
}, this);
|
|
59
84
|
// Render to HTML
|
|
60
85
|
const html = ReactDOMServer.renderToStaticMarkup(JSX);
|
|
61
86
|
return html;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/Diff/converters/relationship/index.tsx"],"sourcesContent":["import type { FileData, PayloadRequest, TypeWithID } from 'payload'\n\nimport { getTranslation, type I18nClient } from '@payloadcms/translations'\n\nimport './index.scss'\n\nimport { formatAdminURL } from 'payload/shared'\n\nimport type { HTMLConvertersAsync } from '../../../../features/converters/lexicalToHtml/async/types.js'\nimport type { SerializedRelationshipNode } from '../../../../nodeTypes.js'\n\nconst baseClass = 'lexical-relationship-diff'\n\nexport const RelationshipDiffHTMLConverterAsync: (args: {\n i18n: I18nClient\n req: PayloadRequest\n}) => HTMLConvertersAsync<SerializedRelationshipNode> = ({ i18n, req }) => {\n return {\n relationship: async ({ node, populate, providedCSSString }) => {\n let data: (Record<string, any> & TypeWithID) | undefined = undefined\n\n const id = typeof node.value === 'object' ? node.value.id : node.value\n\n // If there's no valid upload data, populate return an empty string\n if (typeof node.value !== 'object') {\n if (!populate) {\n return ''\n }\n data = await populate<FileData & TypeWithID>({\n id,\n collectionSlug: node.relationTo,\n })\n } else {\n data = node.value as unknown as FileData & TypeWithID\n }\n\n const relatedCollection = req.payload.collections[node.relationTo]?.config\n\n const ReactDOMServer = (await import('react-dom/server')).default\n\n const JSX = (\n <div\n className={`${baseClass}${providedCSSString}`}\n data-enable-match=\"true\"\n data-id={id}\n data-slug={node.relationTo}\n >\n <div className={`${baseClass}__card`}>\n <div className={`${baseClass}__collectionLabel`}>\n {i18n.t('fields:labelRelationship', {\n label: relatedCollection?.labels?.singular\n ? getTranslation(relatedCollection?.labels?.singular, i18n)\n : relatedCollection?.slug,\n })}\n </div>\n {data &&\n relatedCollection?.admin?.useAsTitle &&\n data[relatedCollection.admin.useAsTitle] ? (\n <strong className={`${baseClass}__title`} data-enable-match=\"false\">\n <a\n className={`${baseClass}__link`}\n data-enable-match=\"false\"\n href={formatAdminURL({\n adminRoute: req.payload.config.routes.admin,\n path: `/collections/${relatedCollection?.slug}/${data.id}`,\n serverURL: req.payload.config.serverURL,\n })}\n rel=\"noopener noreferrer\"\n target=\"_blank\"\n >\n {data[relatedCollection.admin.useAsTitle]}\n </a>\n </strong>\n ) : (\n <strong>{id as string}</strong>\n )}\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":["getTranslation","formatAdminURL","baseClass","RelationshipDiffHTMLConverterAsync","i18n","req","relationship","node","populate","providedCSSString","data","undefined","id","value","collectionSlug","relationTo","relatedCollection","payload","collections","config","ReactDOMServer","default","JSX","div","className","data-enable-match","data-id","data-slug","t","label","labels","singular","slug","admin","useAsTitle","strong","a","href","adminRoute","routes","path","serverURL","rel","target","html","renderToStaticMarkup"],"mappings":";AAEA,SAASA,cAAc,QAAyB,2BAA0B;
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/Diff/converters/relationship/index.tsx"],"sourcesContent":["import type { FileData, PayloadRequest, TypeWithID } from 'payload'\n\nimport { getTranslation, type I18nClient } from '@payloadcms/translations'\n\nimport './index.scss'\n\nimport { formatAdminURL } from 'payload/shared'\n\nimport type { HTMLConvertersAsync } from '../../../../features/converters/lexicalToHtml/async/types.js'\nimport type { SerializedRelationshipNode } from '../../../../nodeTypes.js'\n\nconst baseClass = 'lexical-relationship-diff'\n\nexport const RelationshipDiffHTMLConverterAsync: (args: {\n i18n: I18nClient\n req: PayloadRequest\n}) => HTMLConvertersAsync<SerializedRelationshipNode> = ({ i18n, req }) => {\n return {\n relationship: async ({ node, populate, providedCSSString }) => {\n let data: (Record<string, any> & TypeWithID) | undefined = undefined\n\n const id = typeof node.value === 'object' ? node.value.id : node.value\n\n // If there's no valid upload data, populate return an empty string\n if (typeof node.value !== 'object') {\n if (!populate) {\n return ''\n }\n data = await populate<FileData & TypeWithID>({\n id,\n collectionSlug: node.relationTo,\n })\n } else {\n data = node.value as unknown as FileData & TypeWithID\n }\n\n const relatedCollection = req.payload.collections[node.relationTo]?.config\n\n const ReactDOMServer = (await import('react-dom/server')).default\n\n const JSX = (\n <div\n className={`${baseClass}${providedCSSString}`}\n data-enable-match=\"true\"\n data-id={id}\n data-slug={node.relationTo}\n >\n <div className={`${baseClass}__card`}>\n <div className={`${baseClass}__collectionLabel`}>\n {i18n.t('fields:labelRelationship', {\n label: relatedCollection?.labels?.singular\n ? getTranslation(relatedCollection?.labels?.singular, i18n)\n : relatedCollection?.slug,\n })}\n </div>\n {data &&\n relatedCollection?.admin?.useAsTitle &&\n data[relatedCollection.admin.useAsTitle] ? (\n <strong className={`${baseClass}__title`} data-enable-match=\"false\">\n <a\n className={`${baseClass}__link`}\n data-enable-match=\"false\"\n href={formatAdminURL({\n adminRoute: req.payload.config.routes.admin,\n path: `/collections/${relatedCollection?.slug}/${data.id}`,\n serverURL: req.payload.config.serverURL,\n })}\n rel=\"noopener noreferrer\"\n target=\"_blank\"\n >\n {data[relatedCollection.admin.useAsTitle]}\n </a>\n </strong>\n ) : (\n <strong>{id as string}</strong>\n )}\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":["getTranslation","formatAdminURL","baseClass","RelationshipDiffHTMLConverterAsync","i18n","req","relationship","node","populate","providedCSSString","data","undefined","id","value","collectionSlug","relationTo","relatedCollection","payload","collections","config","ReactDOMServer","default","JSX","div","className","data-enable-match","data-id","data-slug","t","label","labels","singular","slug","admin","useAsTitle","strong","a","href","adminRoute","routes","path","serverURL","rel","target","html","renderToStaticMarkup"],"mappings":";AAEA,SAASA,cAAc,QAAyB,2BAA0B;AAE1E,OAAO,eAAc;AAErB,SAASC,cAAc,QAAQ,iBAAgB;AAK/C,MAAMC,YAAY;AAElB,OAAO,MAAMC,qCAG2C,CAAC,EAAEC,IAAI,EAAEC,GAAG,EAAE;IACpE,OAAO;QACLC,cAAc,OAAO,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,iBAAiB,EAAE;YACxD,IAAIC,OAAuDC;YAE3D,MAAMC,KAAK,OAAOL,KAAKM,KAAK,KAAK,WAAWN,KAAKM,KAAK,CAACD,EAAE,GAAGL,KAAKM,KAAK;YAEtE,mEAAmE;YACnE,IAAI,OAAON,KAAKM,KAAK,KAAK,UAAU;gBAClC,IAAI,CAACL,UAAU;oBACb,OAAO;gBACT;gBACAE,OAAO,MAAMF,SAAgC;oBAC3CI;oBACAE,gBAAgBP,KAAKQ,UAAU;gBACjC;YACF,OAAO;gBACLL,OAAOH,KAAKM,KAAK;YACnB;YAEA,MAAMG,oBAAoBX,IAAIY,OAAO,CAACC,WAAW,CAACX,KAAKQ,UAAU,CAAC,EAAEI;YAEpE,MAAMC,iBAAiB,AAAC,CAAA,MAAM,MAAM,CAAC,mBAAkB,EAAGC,OAAO;YAEjE,MAAMC,oBACJ,QAACC;gBACCC,WAAW,GAAGtB,YAAYO,mBAAmB;gBAC7CgB,qBAAkB;gBAClBC,WAASd;gBACTe,aAAWpB,KAAKQ,UAAU;0BAE1B,cAAA,QAACQ;oBAAIC,WAAW,GAAGtB,UAAU,MAAM,CAAC;;sCAClC,QAACqB;4BAAIC,WAAW,GAAGtB,UAAU,iBAAiB,CAAC;sCAC5CE,KAAKwB,CAAC,CAAC,4BAA4B;gCAClCC,OAAOb,mBAAmBc,QAAQC,WAC9B/B,eAAegB,mBAAmBc,QAAQC,UAAU3B,QACpDY,mBAAmBgB;4BACzB;;;;;;wBAEDtB,QACDM,mBAAmBiB,OAAOC,cAC1BxB,IAAI,CAACM,kBAAkBiB,KAAK,CAACC,UAAU,CAAC,iBACtC,QAACC;4BAAOX,WAAW,GAAGtB,UAAU,OAAO,CAAC;4BAAEuB,qBAAkB;sCAC1D,cAAA,QAACW;gCACCZ,WAAW,GAAGtB,UAAU,MAAM,CAAC;gCAC/BuB,qBAAkB;gCAClBY,MAAMpC,eAAe;oCACnBqC,YAAYjC,IAAIY,OAAO,CAACE,MAAM,CAACoB,MAAM,CAACN,KAAK;oCAC3CO,MAAM,CAAC,aAAa,EAAExB,mBAAmBgB,KAAK,CAAC,EAAEtB,KAAKE,EAAE,EAAE;oCAC1D6B,WAAWpC,IAAIY,OAAO,CAACE,MAAM,CAACsB,SAAS;gCACzC;gCACAC,KAAI;gCACJC,QAAO;0CAENjC,IAAI,CAACM,kBAAkBiB,KAAK,CAACC,UAAU,CAAC;;;;;;;;;;iDAI7C,QAACC;sCAAQvB;;;;;;;;;;;;;;;;;YAMjB,iBAAiB;YACjB,MAAMgC,OAAOxB,eAAeyB,oBAAoB,CAACvB;YAEjD,OAAOsB;QACT;IACF;AACF,EAAC"}
|
|
@@ -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,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
2
|
+
import './index.scss';
|
|
2
3
|
import { createHash } from 'crypto';
|
|
3
4
|
const baseClass = 'lexical-unknown-diff';
|
|
4
5
|
export const UnknownDiffHTMLConverterAsync = ({ i18n, req })=>{
|
|
@@ -16,27 +17,47 @@ export const UnknownDiffHTMLConverterAsync = ({ i18n, req })=>{
|
|
|
16
17
|
nodeTypeSpecifier = node.fields.blockType;
|
|
17
18
|
nodeType = 'InlineBlock';
|
|
18
19
|
}
|
|
19
|
-
const JSX = /*#__PURE__*/
|
|
20
|
+
const JSX = /*#__PURE__*/ _jsxDEV("div", {
|
|
20
21
|
className: `${baseClass}${providedCSSString}`,
|
|
21
22
|
"data-enable-match": "true",
|
|
22
23
|
"data-fields-hash": `${nodeFieldsHash}`,
|
|
23
24
|
children: [
|
|
24
|
-
nodeTypeSpecifier && /*#__PURE__*/
|
|
25
|
+
nodeTypeSpecifier && /*#__PURE__*/ _jsxDEV("span", {
|
|
25
26
|
className: `${baseClass}__specifier`,
|
|
26
27
|
children: [
|
|
27
28
|
nodeTypeSpecifier,
|
|
28
29
|
" "
|
|
29
30
|
]
|
|
30
|
-
}
|
|
31
|
-
|
|
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", {
|
|
32
37
|
children: nodeType
|
|
33
|
-
}
|
|
34
|
-
|
|
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", {
|
|
35
44
|
className: `${baseClass}__meta`,
|
|
36
|
-
children: /*#__PURE__*/
|
|
37
|
-
|
|
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)
|
|
38
55
|
]
|
|
39
|
-
}
|
|
56
|
+
}, void 0, true, {
|
|
57
|
+
fileName: "src/field/Diff/converters/unknown/index.tsx",
|
|
58
|
+
lineNumber: 41,
|
|
59
|
+
columnNumber: 9
|
|
60
|
+
}, this);
|
|
40
61
|
// Render to HTML
|
|
41
62
|
const html = ReactDOMServer.renderToStaticMarkup(JSX);
|
|
42
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":";
|
|
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,6 +1,7 @@
|
|
|
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
|
+
import './index.scss';
|
|
4
5
|
import { formatFilesize } from 'payload/shared';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
const baseClass = 'lexical-upload-diff';
|
|
@@ -29,7 +30,7 @@ export const UploadDiffHTMLConverterAsync = ({ i18n, req })=>{
|
|
|
29
30
|
const ReactDOMServer = (await import('react-dom/server')).default;
|
|
30
31
|
// hash fields to ensure they are diffed if they change
|
|
31
32
|
const nodeFieldsHash = createHash('sha256').update(JSON.stringify(node.fields ?? {})).digest('hex');
|
|
32
|
-
const JSX = /*#__PURE__*/
|
|
33
|
+
const JSX = /*#__PURE__*/ _jsxDEV("div", {
|
|
33
34
|
className: `${baseClass}${providedCSSString}`,
|
|
34
35
|
"data-enable-match": "true",
|
|
35
36
|
"data-fields-hash": `${nodeFieldsHash}`,
|
|
@@ -37,48 +38,88 @@ export const UploadDiffHTMLConverterAsync = ({ i18n, req })=>{
|
|
|
37
38
|
"data-lexical-upload-id": uploadNode.value,
|
|
38
39
|
"data-lexical-upload-relation-to": uploadNode.relationTo,
|
|
39
40
|
"data-src": thumbnailSRC,
|
|
40
|
-
children: /*#__PURE__*/
|
|
41
|
+
children: /*#__PURE__*/ _jsxDEV("div", {
|
|
41
42
|
className: `${baseClass}__card`,
|
|
42
43
|
children: [
|
|
43
|
-
/*#__PURE__*/
|
|
44
|
+
/*#__PURE__*/ _jsxDEV("div", {
|
|
44
45
|
className: `${baseClass}__thumbnail`,
|
|
45
|
-
children: thumbnailSRC?.length ? /*#__PURE__*/
|
|
46
|
+
children: thumbnailSRC?.length ? /*#__PURE__*/ _jsxDEV("img", {
|
|
46
47
|
alt: uploadDoc?.filename,
|
|
47
48
|
src: thumbnailSRC
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
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", {
|
|
51
64
|
className: `${baseClass}__info`,
|
|
52
65
|
"data-enable-match": "false",
|
|
53
66
|
children: [
|
|
54
|
-
/*#__PURE__*/
|
|
67
|
+
/*#__PURE__*/ _jsxDEV("strong", {
|
|
55
68
|
children: uploadDoc?.filename
|
|
56
|
-
}
|
|
57
|
-
|
|
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", {
|
|
58
75
|
className: `${baseClass}__meta`,
|
|
59
76
|
children: [
|
|
60
77
|
formatFilesize(uploadDoc?.filesize),
|
|
61
|
-
typeof uploadDoc?.width === 'number' && typeof uploadDoc?.height === 'number' && /*#__PURE__*/
|
|
78
|
+
typeof uploadDoc?.width === 'number' && typeof uploadDoc?.height === 'number' && /*#__PURE__*/ _jsxDEV(React.Fragment, {
|
|
62
79
|
children: [
|
|
63
80
|
" - ",
|
|
64
81
|
uploadDoc?.width,
|
|
65
82
|
"x",
|
|
66
83
|
uploadDoc?.height
|
|
67
84
|
]
|
|
68
|
-
}
|
|
69
|
-
|
|
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, {
|
|
70
91
|
children: [
|
|
71
92
|
" - ",
|
|
72
93
|
uploadDoc?.mimeType
|
|
73
94
|
]
|
|
74
|
-
}
|
|
95
|
+
}, void 0, true, {
|
|
96
|
+
fileName: "src/field/Diff/converters/upload/index.tsx",
|
|
97
|
+
lineNumber: 86,
|
|
98
|
+
columnNumber: 19
|
|
99
|
+
}, this)
|
|
75
100
|
]
|
|
76
|
-
}
|
|
101
|
+
}, void 0, true, {
|
|
102
|
+
fileName: "src/field/Diff/converters/upload/index.tsx",
|
|
103
|
+
lineNumber: 77,
|
|
104
|
+
columnNumber: 15
|
|
105
|
+
}, this)
|
|
77
106
|
]
|
|
78
|
-
}
|
|
107
|
+
}, void 0, true, {
|
|
108
|
+
fileName: "src/field/Diff/converters/upload/index.tsx",
|
|
109
|
+
lineNumber: 75,
|
|
110
|
+
columnNumber: 13
|
|
111
|
+
}, this)
|
|
79
112
|
]
|
|
80
|
-
}
|
|
81
|
-
|
|
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);
|
|
82
123
|
// Render to HTML
|
|
83
124
|
const html = ReactDOMServer.renderToStaticMarkup(JSX);
|
|
84
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;
|
|
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"}
|