@payloadcms/richtext-lexical 4.0.0-internal.4804abd → 4.0.0-internal.4c2ee12
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/LICENSE.md +1 -1
- package/dist/exports/client/Field-MT4FK3IP.js +2 -0
- package/dist/exports/client/Field-MT4FK3IP.js.map +7 -0
- package/dist/exports/client/chunk-3LRZDIIG.js +2 -0
- package/dist/exports/client/{chunk-X3D4LZS7.js.map → chunk-3LRZDIIG.js.map} +4 -4
- package/dist/exports/client/chunk-E6LSRRP2.js +2 -0
- package/dist/exports/client/chunk-E6LSRRP2.js.map +7 -0
- package/dist/exports/client/chunk-ZQX5HXUL.js +2 -0
- package/dist/exports/client/chunk-ZQX5HXUL.js.map +7 -0
- package/dist/exports/client/component-6DQLENIE.js +2 -0
- package/dist/exports/client/component-6DQLENIE.js.map +7 -0
- package/dist/exports/client/componentInline-HNE5G4TE.js +2 -0
- package/dist/exports/client/index.d.ts +1 -2
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +28 -28
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/align/client/toolbarAlignGroup.d.ts.map +1 -1
- package/dist/features/blocks/client/component/BlockReordering/index.d.ts +11 -0
- package/dist/features/blocks/client/component/BlockReordering/index.d.ts.map +1 -0
- package/dist/features/blocks/client/component/BlockReordering/index.js +18 -0
- package/dist/features/blocks/client/component/BlockReordering/index.js.map +1 -0
- package/dist/features/blocks/client/component/index.d.ts +0 -6
- package/dist/features/blocks/client/component/index.d.ts.map +1 -1
- package/dist/features/blocks/client/component/index.js +169 -101
- package/dist/features/blocks/client/component/index.js.map +1 -1
- package/dist/features/blocks/client/component/useBlockReordering.d.ts +16 -0
- package/dist/features/blocks/client/component/useBlockReordering.d.ts.map +1 -0
- package/dist/features/blocks/client/component/useBlockReordering.js +178 -0
- package/dist/features/blocks/client/component/useBlockReordering.js.map +1 -0
- package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.d.ts.map +1 -1
- package/dist/features/blocks/client/componentInline/index.css +0 -1
- package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
- package/dist/features/blocks/client/componentInline/index.js +30 -22
- package/dist/features/blocks/client/componentInline/index.js.map +1 -1
- package/dist/features/blocks/client/getBlockImageComponent.d.ts +1 -1
- package/dist/features/blocks/client/getCachedFormStateIfDataMatches.d.ts +9 -0
- package/dist/features/blocks/client/getCachedFormStateIfDataMatches.d.ts.map +1 -0
- package/dist/features/blocks/client/getCachedFormStateIfDataMatches.js +95 -0
- package/dist/features/blocks/client/getCachedFormStateIfDataMatches.js.map +1 -0
- package/dist/features/blocks/client/markdown/markdownTransformer.d.ts.map +1 -1
- package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/client/nodes/BlocksNode.js +0 -10
- package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
- package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/server/graphQLPopulationPromise.d.ts.map +1 -1
- package/dist/features/blocks/server/index.js +2 -2
- package/dist/features/blocks/server/index.js.map +1 -1
- package/dist/features/blocks/server/markdown/markdownTransformer.d.ts.map +1 -1
- package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/server/nodes/BlocksNode.js +1 -12
- package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
- package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/server/nodes/InlineBlocksNode.js +2 -2
- package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
- package/dist/features/blocks/server/schema.d.ts +2 -0
- package/dist/features/blocks/server/schema.d.ts.map +1 -1
- package/dist/features/blocks/server/schema.js +7 -9
- package/dist/features/blocks/server/schema.js.map +1 -1
- package/dist/features/blocks/server/validate.d.ts.map +1 -1
- package/dist/features/blocks/server/validate.js +1 -1
- package/dist/features/blocks/server/validate.js.map +1 -1
- package/dist/features/converters/htmlToLexical/index.d.ts.map +1 -1
- package/dist/features/converters/lexicalToHtml/async/converters/heading.js +1 -1
- package/dist/features/converters/lexicalToHtml/async/converters/heading.js.map +1 -1
- package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts.map +1 -1
- package/dist/features/converters/lexicalToHtml/async/converters/list.js +4 -3
- package/dist/features/converters/lexicalToHtml/async/converters/list.js.map +1 -1
- package/dist/features/converters/lexicalToHtml/async/converters/upload.js +3 -3
- package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
- package/dist/features/converters/lexicalToHtml/shared/cssColors.d.ts.map +1 -1
- package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.d.ts.map +1 -1
- package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js +3 -2
- package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js.map +1 -1
- package/dist/features/converters/lexicalToHtml/sync/converters/heading.js +1 -1
- package/dist/features/converters/lexicalToHtml/sync/converters/heading.js.map +1 -1
- package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts.map +1 -1
- package/dist/features/converters/lexicalToHtml/sync/converters/list.js +4 -3
- package/dist/features/converters/lexicalToHtml/sync/converters/list.js.map +1 -1
- package/dist/features/converters/lexicalToHtml/sync/converters/upload.js +3 -3
- package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +2 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/list.js +2 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/upload.d.ts.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/upload.js +4 -5
- package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
- package/dist/features/converters/lexicalToMarkdown/index.d.ts.map +1 -1
- package/dist/features/converters/markdownToLexical/index.d.ts.map +1 -1
- package/dist/features/converters/utilities/payloadPopulateFn.d.ts.map +1 -1
- package/dist/features/converters/utilities/payloadPopulateFn.js +4 -2
- package/dist/features/converters/utilities/payloadPopulateFn.js.map +1 -1
- package/dist/features/debug/testRecorder/client/plugin/index.css +0 -1
- package/dist/features/format/shared/toolbarFormatGroup.d.ts.map +1 -1
- package/dist/features/heading/constants.d.ts +2 -0
- package/dist/features/heading/constants.d.ts.map +1 -0
- package/dist/features/heading/constants.js +2 -0
- package/dist/features/heading/constants.js.map +1 -0
- package/dist/features/heading/server/index.d.ts.map +1 -1
- package/dist/features/heading/server/index.js +5 -1
- package/dist/features/heading/server/index.js.map +1 -1
- package/dist/features/heading/server/schema.d.ts.map +1 -1
- package/dist/features/heading/server/validate.d.ts +6 -0
- package/dist/features/heading/server/validate.d.ts.map +1 -0
- package/dist/features/heading/server/validate.js +15 -0
- package/dist/features/heading/server/validate.js.map +1 -0
- package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +12 -2
- package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
- package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js +18 -1
- package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
- package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +1 -1
- package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
- package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js +3 -3
- package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
- package/dist/features/horizontalRule/server/schema.d.ts +1 -0
- package/dist/features/horizontalRule/server/schema.d.ts.map +1 -1
- package/dist/features/horizontalRule/server/schema.js +6 -5
- package/dist/features/horizontalRule/server/schema.js.map +1 -1
- package/dist/features/indent/client/IndentPlugin.d.ts.map +1 -1
- package/dist/features/indent/client/IndentPlugin.js +122 -1
- package/dist/features/indent/client/IndentPlugin.js.map +1 -1
- package/dist/features/indent/client/toolbarIndentGroup.d.ts.map +1 -1
- package/dist/features/indent/server/i18n.d.ts.map +1 -1
- package/dist/features/indent/server/i18n.js +74 -37
- package/dist/features/indent/server/i18n.js.map +1 -1
- package/dist/features/link/client/plugins/autoLink/index.d.ts.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +8 -5
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/index.css +0 -2
- package/dist/features/link/markdownTransformer.d.ts.map +1 -1
- package/dist/features/link/nodes/AutoLinkNode.d.ts +1 -1
- package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
- package/dist/features/link/nodes/AutoLinkNode.js +2 -10
- package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
- package/dist/features/link/nodes/LinkNode.d.ts +1 -1
- package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
- package/dist/features/link/nodes/LinkNode.js +2 -15
- package/dist/features/link/nodes/LinkNode.js.map +1 -1
- package/dist/features/link/server/baseFields.d.ts.map +1 -1
- package/dist/features/link/server/baseFields.js.map +1 -1
- package/dist/features/link/server/graphQLPopulationPromise.d.ts.map +1 -1
- package/dist/features/link/server/index.js +2 -2
- package/dist/features/link/server/index.js.map +1 -1
- package/dist/features/link/server/schema.d.ts.map +1 -1
- package/dist/features/link/server/validate.d.ts.map +1 -1
- package/dist/features/link/server/validate.js +1 -1
- package/dist/features/link/server/validate.js.map +1 -1
- package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
- package/dist/features/lists/checklist/server/index.js +5 -2
- package/dist/features/lists/checklist/server/index.js.map +1 -1
- package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
- package/dist/features/lists/orderedList/server/index.js +5 -2
- package/dist/features/lists/orderedList/server/index.js.map +1 -1
- package/dist/features/lists/shared/constants.d.ts +2 -0
- package/dist/features/lists/shared/constants.d.ts.map +1 -0
- package/dist/features/lists/shared/constants.js +2 -0
- package/dist/features/lists/shared/constants.js.map +1 -0
- package/dist/features/lists/shared/validate.d.ts +5 -0
- package/dist/features/lists/shared/validate.d.ts.map +1 -0
- package/dist/features/lists/shared/validate.js +15 -0
- package/dist/features/lists/shared/validate.js.map +1 -0
- package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
- package/dist/features/lists/unorderedList/server/index.js +5 -2
- package/dist/features/lists/unorderedList/server/index.js.map +1 -1
- package/dist/features/relationship/client/components/index.css +3 -6
- package/dist/features/relationship/client/drawer/index.d.ts.map +1 -1
- package/dist/features/relationship/client/index.d.ts +2 -2
- package/dist/features/relationship/client/index.d.ts.map +1 -1
- package/dist/features/relationship/client/index.js.map +1 -1
- package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
- package/dist/features/relationship/client/nodes/RelationshipNode.js +0 -3
- package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
- package/dist/features/relationship/client/plugins/index.d.ts +2 -2
- package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
- package/dist/features/relationship/client/plugins/index.js +27 -31
- package/dist/features/relationship/client/plugins/index.js.map +1 -1
- package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts +2 -4
- package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
- package/dist/features/relationship/client/utils/useEnabledRelationships.js +53 -20
- package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
- package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +2 -2
- package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
- package/dist/features/relationship/server/graphQLPopulationPromise.js +2 -2
- package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
- package/dist/features/relationship/server/index.d.ts +8 -1
- package/dist/features/relationship/server/index.d.ts.map +1 -1
- package/dist/features/relationship/server/index.js +28 -11
- package/dist/features/relationship/server/index.js.map +1 -1
- package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
- package/dist/features/relationship/server/nodes/RelationshipNode.js +1 -5
- package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
- package/dist/features/relationship/server/schema.d.ts +3 -2
- package/dist/features/relationship/server/schema.d.ts.map +1 -1
- package/dist/features/relationship/server/schema.js +9 -12
- package/dist/features/relationship/server/schema.js.map +1 -1
- package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +1 -6
- package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -1
- package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +1 -5
- package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -1
- package/dist/features/shared/toolbar/addDropdownGroup.d.ts.map +1 -1
- package/dist/features/shared/toolbar/featureButtonsGroup.d.ts.map +1 -1
- package/dist/features/shared/toolbar/textDropdownGroup.d.ts.map +1 -1
- package/dist/features/table/client/index.d.ts.map +1 -0
- package/dist/features/table/client/index.js.map +1 -0
- package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts +8 -0
- package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts.map +1 -0
- package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js +19 -0
- package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js.map +1 -0
- package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.css +0 -1
- package/dist/features/table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -0
- package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.js +17 -44
- package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js.map +1 -0
- package/dist/features/table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -0
- package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.js +41 -18
- package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js.map +1 -0
- package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -0
- package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -0
- package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.css +0 -3
- package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +1 -0
- package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.js.map +1 -0
- package/dist/features/table/client/plugins/TablePlugin/index.d.ts.map +1 -0
- package/dist/features/table/client/plugins/TablePlugin/index.js.map +1 -0
- package/dist/features/table/client/utils/debounce.d.ts.map +1 -0
- package/dist/features/table/client/utils/debounce.js.map +1 -0
- package/dist/features/table/client/utils/useDebounce.d.ts.map +1 -0
- package/dist/features/table/client/utils/useDebounce.js.map +1 -0
- package/dist/features/table/markdownTransformer.d.ts.map +1 -0
- package/dist/features/table/markdownTransformer.js.map +1 -0
- package/dist/features/table/server/index.d.ts +3 -0
- package/dist/features/table/server/index.d.ts.map +1 -0
- package/dist/features/{experimental_table → table}/server/index.js +4 -4
- package/dist/features/table/server/index.js.map +1 -0
- package/dist/features/table/server/schema.d.ts.map +1 -0
- package/dist/features/table/server/schema.js.map +1 -0
- package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts +8 -0
- package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts.map +1 -0
- package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js +80 -0
- package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js.map +1 -0
- package/dist/features/toolbars/fixed/client/Toolbar/index.css +78 -6
- package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.js +19 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/inline/client/Toolbar/index.css +0 -1
- package/dist/features/toolbars/inline/client/Toolbar/index.d.ts.map +1 -1
- package/dist/features/toolbars/inline/client/Toolbar/index.js +17 -2
- package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
- package/dist/features/toolbars/shared/ToolbarButton/index.js +1 -0
- package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +85 -32
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.css +16 -14
- package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
- package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.d.ts +5 -0
- package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.d.ts.map +1 -0
- package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.js +79 -0
- package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.js.map +1 -0
- package/dist/features/typesServer.d.ts +17 -12
- package/dist/features/typesServer.d.ts.map +1 -1
- package/dist/features/typesServer.js.map +1 -1
- package/dist/features/upload/client/component/index.css +0 -2
- package/dist/features/upload/client/component/index.js +2 -1
- package/dist/features/upload/client/component/index.js.map +1 -1
- package/dist/features/upload/client/drawer/index.d.ts.map +1 -1
- package/dist/features/upload/client/index.d.ts +3 -2
- package/dist/features/upload/client/index.d.ts.map +1 -1
- package/dist/features/upload/client/index.js.map +1 -1
- package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
- package/dist/features/upload/client/nodes/UploadNode.js +0 -7
- package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
- package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
- package/dist/features/upload/client/plugin/index.js +50 -53
- package/dist/features/upload/client/plugin/index.js.map +1 -1
- package/dist/features/upload/server/graphQLPopulationPromise.d.ts +2 -2
- package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
- package/dist/features/upload/server/graphQLPopulationPromise.js +1 -1
- package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
- package/dist/features/upload/server/index.d.ts +7 -3
- package/dist/features/upload/server/index.d.ts.map +1 -1
- package/dist/features/upload/server/index.js +20 -16
- package/dist/features/upload/server/index.js.map +1 -1
- package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
- package/dist/features/upload/server/nodes/UploadNode.js +1 -9
- package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
- package/dist/features/upload/server/schema.d.ts +4 -16
- package/dist/features/upload/server/schema.d.ts.map +1 -1
- package/dist/features/upload/server/schema.js +8 -10
- package/dist/features/upload/server/schema.js.map +1 -1
- package/dist/features/upload/server/validate.d.ts +2 -2
- package/dist/features/upload/server/validate.d.ts.map +1 -1
- package/dist/features/upload/server/validate.js +4 -1
- package/dist/features/upload/server/validate.js.map +1 -1
- package/dist/field/Diff/converters/listitem/index.d.ts.map +1 -1
- package/dist/field/Diff/converters/listitem/index.js +2 -1
- package/dist/field/Diff/converters/listitem/index.js.map +1 -1
- package/dist/field/Diff/converters/relationship/index.css +0 -1
- package/dist/field/Diff/converters/unknown/index.css +0 -1
- package/dist/field/Diff/converters/upload/index.css +0 -1
- package/dist/field/Diff/converters/upload/index.js.map +1 -1
- package/dist/field/Diff/index.css +0 -2
- package/dist/field/Diff/index.d.ts +3 -2
- package/dist/field/Diff/index.d.ts.map +1 -1
- package/dist/field/Diff/index.js +3 -2
- package/dist/field/Diff/index.js.map +1 -1
- package/dist/field/Field.d.ts.map +1 -1
- package/dist/field/Field.js +26 -16
- package/dist/field/Field.js.map +1 -1
- package/dist/field/RenderLexical/index.d.ts +3 -1
- package/dist/field/RenderLexical/index.d.ts.map +1 -1
- package/dist/field/RenderLexical/index.js +23 -23
- package/dist/field/RenderLexical/index.js.map +1 -1
- package/dist/field/ViewSelector.d.ts.map +1 -1
- package/dist/field/ViewSelector.js +1 -0
- package/dist/field/ViewSelector.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/field/index.css +2 -3
- package/dist/field/rscEntry.d.ts +2 -2
- package/dist/field/rscEntry.d.ts.map +1 -1
- package/dist/field/rscEntry.js.map +1 -1
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +68 -0
- package/dist/i18n.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -52
- package/dist/index.js.map +1 -1
- package/dist/lexical/LexicalEditor.css +30 -19
- package/dist/lexical/LexicalEditor.d.ts.map +1 -1
- package/dist/lexical/LexicalEditor.js +62 -99
- package/dist/lexical/LexicalEditor.js.map +1 -1
- package/dist/lexical/LexicalProvider.d.ts.map +1 -1
- package/dist/lexical/LexicalProvider.js +7 -22
- package/dist/lexical/LexicalProvider.js.map +1 -1
- package/dist/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
- package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
- package/dist/lexical/config/server/loader.d.ts +1 -1
- package/dist/lexical/config/server/loader.d.ts.map +1 -1
- package/dist/lexical/config/server/loader.js +2 -2
- package/dist/lexical/config/server/loader.js.map +1 -1
- package/dist/lexical/config/server/sanitize.d.ts +1 -1
- package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
- package/dist/lexical/config/server/sanitize.js +2 -2
- package/dist/lexical/config/server/sanitize.js.map +1 -1
- package/dist/lexical/plugins/DecoratorPlugin/index.d.ts.map +1 -1
- package/dist/lexical/plugins/DecoratorPlugin/index.js +24 -21
- package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.css +18 -25
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.d.ts.map +1 -1
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +27 -14
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
- package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts.map +1 -1
- package/dist/lexical/plugins/NodeViewOverridePlugin/index.js +21 -0
- package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts +0 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +2 -21
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/index.css +0 -2
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.css +1 -0
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +2 -2
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +2 -0
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +16 -2
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts +7 -0
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts.map +1 -0
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js +65 -0
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js.map +1 -0
- package/dist/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/utils/setHandlePosition.js +2 -0
- package/dist/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
- package/dist/lexical/theme/EditorTheme.css +0 -2
- package/dist/lexical/ui/ContentEditable.css +19 -14
- package/dist/lexical/ui/ContentEditable.d.ts +2 -1
- package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
- package/dist/lexical/ui/ContentEditable.js +21 -7
- package/dist/lexical/ui/ContentEditable.js.map +1 -1
- package/dist/lexical/ui/icons/H3/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/H3/index.js +13 -6
- package/dist/lexical/ui/icons/H3/index.js.map +1 -1
- package/dist/lexical/ui/icons/H4/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/H4/index.js +13 -6
- package/dist/lexical/ui/icons/H4/index.js.map +1 -1
- package/dist/lexical/ui/icons/H5/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/H5/index.js +13 -6
- package/dist/lexical/ui/icons/H5/index.js.map +1 -1
- package/dist/lexical/ui/icons/H6/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/H6/index.js +13 -6
- package/dist/lexical/ui/icons/H6/index.js.map +1 -1
- package/dist/lexical/utils/markdown/createBlockNode.d.ts +1 -1
- package/dist/lexical/utils/markdown/createBlockNode.d.ts.map +1 -1
- package/dist/lexical/utils/nodeFormat.d.ts.map +1 -1
- package/dist/lexical/utils/point.d.ts.map +1 -1
- package/dist/lexical/utils/rect.d.ts.map +1 -1
- package/dist/lexical-proxy/@lexical-react/ExtensionComponent.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/ExtensionComponent.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/ExtensionComponent.js +2 -0
- package/dist/lexical-proxy/@lexical-react/ExtensionComponent.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/ReactExtension.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/ReactExtension.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/ReactExtension.js +2 -0
- package/dist/lexical-proxy/@lexical-react/ReactExtension.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.js +2 -0
- package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.js +2 -0
- package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/TreeViewExtension.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/TreeViewExtension.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/TreeViewExtension.js +2 -0
- package/dist/lexical-proxy/@lexical-react/TreeViewExtension.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/useExtensionComponent.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/useExtensionComponent.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/useExtensionComponent.js +2 -0
- package/dist/lexical-proxy/@lexical-react/useExtensionComponent.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.js +2 -0
- package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.js +2 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.js +2 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.js +2 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.js +2 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.js +2 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.js.map +1 -0
- package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts.map +1 -1
- package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.d.ts.map +1 -1
- package/dist/presets/llmInstructions.d.ts +2 -0
- package/dist/presets/llmInstructions.d.ts.map +1 -0
- package/dist/presets/llmInstructions.js +13 -0
- package/dist/presets/llmInstructions.js.map +1 -0
- package/dist/types/builtInNodes.d.ts +1 -1
- package/dist/types/builtInNodes.d.ts.map +1 -1
- package/dist/types/builtInNodes.js +8 -3
- package/dist/types/builtInNodes.js.map +1 -1
- package/dist/types/index.d.ts +4 -7
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/jsonSchemaHelpers.d.ts +5 -1
- package/dist/types/jsonSchemaHelpers.d.ts.map +1 -1
- package/dist/types/jsonSchemaHelpers.js +7 -2
- package/dist/types/jsonSchemaHelpers.js.map +1 -1
- package/dist/types/nodeTypes.d.ts +6 -1
- package/dist/types/nodeTypes.d.ts.map +1 -1
- package/dist/types/nodeTypes.js.map +1 -1
- package/dist/utilities/applyBaseFilterToFields.d.ts.map +1 -1
- package/dist/utilities/applyBaseFilterToFields.js.map +1 -1
- package/dist/utilities/buildInitialState.d.ts +3 -2
- package/dist/utilities/buildInitialState.d.ts.map +1 -1
- package/dist/utilities/buildInitialState.js +1 -0
- package/dist/utilities/buildInitialState.js.map +1 -1
- package/dist/utilities/createServerFeature.d.ts +1 -1
- package/dist/utilities/createServerFeature.d.ts.map +1 -1
- package/dist/utilities/createServerFeature.js +2 -2
- package/dist/utilities/createServerFeature.js.map +1 -1
- package/dist/utilities/editorConfigFactory.d.ts +6 -6
- package/dist/utilities/editorConfigFactory.d.ts.map +1 -1
- package/dist/utilities/editorConfigFactory.js +9 -9
- package/dist/utilities/editorConfigFactory.js.map +1 -1
- package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts +1 -1
- package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts.map +1 -1
- package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.d.ts.map +1 -1
- package/dist/utilities/fieldsDrawer/useLexicalDrawer.d.ts.map +1 -1
- package/dist/utilities/fieldsDrawer/useLexicalListDrawer.d.ts.map +1 -1
- package/dist/utilities/generateImportMap.d.ts +3 -3
- package/dist/utilities/generateImportMap.d.ts.map +1 -1
- package/dist/utilities/generateImportMap.js +3 -7
- package/dist/utilities/generateImportMap.js.map +1 -1
- package/dist/utilities/generateSchemaMap.d.ts +1 -1
- package/dist/utilities/generateSchemaMap.d.ts.map +1 -1
- package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts +2 -2
- package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts.map +1 -1
- package/dist/utilities/getDefaultSanitizedEditorConfig.js +6 -17
- package/dist/utilities/getDefaultSanitizedEditorConfig.js.map +1 -1
- package/dist/utilities/recurseNodeTree.d.ts.map +1 -1
- package/dist/utilities/upgradeLexicalData/index.js +6 -3
- package/dist/utilities/upgradeLexicalData/index.js.map +1 -1
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts.map +1 -1
- package/dist/utilities/useLexicalFeature.d.ts.map +1 -1
- package/dist/validate/hasText.d.ts +2 -2
- package/dist/validate/hasText.d.ts.map +1 -1
- package/dist/validate/hasText.js.map +1 -1
- package/dist/validate/index.d.ts +1 -1
- package/dist/validate/index.d.ts.map +1 -1
- package/package.json +99 -27
- package/dist/@types/assets.d.js +0 -2
- package/dist/@types/assets.d.js.map +0 -1
- package/dist/dependencyChecker.spec.js +0 -16
- package/dist/dependencyChecker.spec.js.map +0 -1
- package/dist/exports/client/Field-DXKR3OGV.js +0 -2
- package/dist/exports/client/Field-DXKR3OGV.js.map +0 -7
- package/dist/exports/client/bundled.css +0 -1
- package/dist/exports/client/chunk-ESITTE3C.js +0 -2
- package/dist/exports/client/chunk-ESITTE3C.js.map +0 -7
- package/dist/exports/client/chunk-UD4DQ4AK.js +0 -2
- package/dist/exports/client/chunk-UD4DQ4AK.js.map +0 -7
- package/dist/exports/client/chunk-X3D4LZS7.js +0 -2
- package/dist/exports/client/component-PHZQBOJE.js +0 -2
- package/dist/exports/client/component-PHZQBOJE.js.map +0 -7
- package/dist/exports/client/componentInline-H24N7GUG.js +0 -2
- package/dist/exports/server/rsc.browser.d.ts +0 -11
- package/dist/exports/server/rsc.browser.d.ts.map +0 -1
- package/dist/exports/server/rsc.browser.js +0 -10
- package/dist/exports/server/rsc.browser.js.map +0 -1
- package/dist/features/blocks/client/component/removeEmptyArrayValues.d.ts +0 -11
- package/dist/features/blocks/client/component/removeEmptyArrayValues.d.ts.map +0 -1
- package/dist/features/blocks/client/component/removeEmptyArrayValues.js +0 -20
- package/dist/features/blocks/client/component/removeEmptyArrayValues.js.map +0 -1
- package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js +0 -180
- package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js.map +0 -1
- package/dist/features/experimental_table/client/index.d.ts.map +0 -1
- package/dist/features/experimental_table/client/index.js.map +0 -1
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts.map +0 -1
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +0 -1
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.d.ts.map +0 -1
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +0 -1
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +0 -1
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +0 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +0 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.js.map +0 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts.map +0 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +0 -1
- package/dist/features/experimental_table/client/utils/debounce.d.ts.map +0 -1
- package/dist/features/experimental_table/client/utils/debounce.js.map +0 -1
- package/dist/features/experimental_table/client/utils/useDebounce.d.ts.map +0 -1
- package/dist/features/experimental_table/client/utils/useDebounce.js.map +0 -1
- package/dist/features/experimental_table/markdownTransformer.d.ts.map +0 -1
- package/dist/features/experimental_table/markdownTransformer.js.map +0 -1
- package/dist/features/experimental_table/server/index.d.ts +0 -3
- package/dist/features/experimental_table/server/index.d.ts.map +0 -1
- package/dist/features/experimental_table/server/index.js.map +0 -1
- package/dist/features/experimental_table/server/schema.d.ts.map +0 -1
- package/dist/features/experimental_table/server/schema.js.map +0 -1
- package/dist/features/link/markdownTransformer.spec.js +0 -195
- package/dist/features/link/markdownTransformer.spec.js.map +0 -1
- package/dist/field/clientEntry.d.ts +0 -29
- package/dist/field/clientEntry.d.ts.map +0 -1
- package/dist/field/clientEntry.js +0 -86
- package/dist/field/clientEntry.js.map +0 -1
- package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js +0 -88
- package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js.map +0 -1
- package/dist/lexical/utils/url.spec.js +0 -114
- package/dist/lexical/utils/url.spec.js.map +0 -1
- package/dist/utilities/jsx/jsx.spec.js +0 -178
- package/dist/utilities/jsx/jsx.spec.js.map +0 -1
- /package/dist/exports/client/{componentInline-H24N7GUG.js.map → componentInline-HNE5G4TE.js.map} +0 -0
- /package/dist/features/{experimental_table → table}/client/index.d.ts +0 -0
- /package/dist/features/{experimental_table → table}/client/index.js +0 -0
- /package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.d.ts +0 -0
- /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.css +0 -0
- /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.d.ts +0 -0
- /package/dist/features/{experimental_table → table}/client/plugins/TableHoverActionsPlugin/index.d.ts +0 -0
- /package/dist/features/{experimental_table → table}/client/plugins/TableHoverActionsPlugin/index.js +0 -0
- /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.d.ts +0 -0
- /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.js +0 -0
- /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.css +0 -0
- /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.d.ts +0 -0
- /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.js +0 -0
- /package/dist/features/{experimental_table → table}/client/utils/debounce.d.ts +0 -0
- /package/dist/features/{experimental_table → table}/client/utils/debounce.js +0 -0
- /package/dist/features/{experimental_table → table}/client/utils/useDebounce.d.ts +0 -0
- /package/dist/features/{experimental_table → table}/client/utils/useDebounce.js +0 -0
- /package/dist/features/{experimental_table → table}/markdownTransformer.d.ts +0 -0
- /package/dist/features/{experimental_table → table}/markdownTransformer.js +0 -0
- /package/dist/features/{experimental_table → table}/server/schema.d.ts +0 -0
- /package/dist/features/{experimental_table → table}/server/schema.js +0 -0
|
@@ -9,12 +9,13 @@ import { abortAndIgnore } from '@payloadcms/ui/shared';
|
|
|
9
9
|
import { $getNodeByKey, SKIP_DOM_SELECTION_TAG } from 'lexical';
|
|
10
10
|
import './index.css';
|
|
11
11
|
import '../../../../utilities/fieldsDrawer/index.css';
|
|
12
|
-
import { deepCopyObjectSimpleWithoutReactComponents
|
|
12
|
+
import { deepCopyObjectSimpleWithoutReactComponents } from 'payload/shared';
|
|
13
13
|
import React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
14
14
|
import { v4 as uuid } from 'uuid';
|
|
15
15
|
import { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js';
|
|
16
16
|
import { RegisterFormSubmit, useDrawerSubmit } from '../../../../utilities/fieldsDrawer/useDrawerSubmit.js';
|
|
17
17
|
import { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js';
|
|
18
|
+
import { getCachedFormStateIfDataMatches, reduceFormStateToBlockData } from '../getCachedFormStateIfDataMatches.js';
|
|
18
19
|
import { $isInlineBlockNode } from '../nodes/InlineBlocksNode.js';
|
|
19
20
|
const InlineBlockComponentContext = /*#__PURE__*/createContext({
|
|
20
21
|
initialState: false
|
|
@@ -53,19 +54,23 @@ export const InlineBlockComponent = props => {
|
|
|
53
54
|
} = useServerFunctions();
|
|
54
55
|
const editDepth = useEditDepth();
|
|
55
56
|
const firstTimeDrawer = useRef(false);
|
|
57
|
+
const blockType = formData.blockType;
|
|
58
|
+
const formDataRef = useRef(formData);
|
|
59
|
+
formDataRef.current = formData;
|
|
60
|
+
const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${blockType}.fields`;
|
|
56
61
|
const [initialState, setInitialState] = React.useState(() => {
|
|
57
62
|
// Initial form state that was calculated server-side. May have stale values
|
|
58
|
-
const
|
|
63
|
+
const cachedState = initialLexicalFormState?.[formData.id];
|
|
64
|
+
const cachedFormState = cachedState?.formState;
|
|
59
65
|
if (!cachedFormState) {
|
|
60
66
|
return false;
|
|
61
67
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
} : fieldState]));
|
|
68
|
+
return getCachedFormStateIfDataMatches({
|
|
69
|
+
cachedFormState,
|
|
70
|
+
cachedSchemaPath: cachedState.schemaPath,
|
|
71
|
+
currentSchemaPath: schemaFieldsPath,
|
|
72
|
+
formData
|
|
73
|
+
});
|
|
69
74
|
});
|
|
70
75
|
const hasMounted = useRef(false);
|
|
71
76
|
const prevCacheBuster = useRef(cacheBuster);
|
|
@@ -141,7 +146,7 @@ export const InlineBlockComponent = props => {
|
|
|
141
146
|
const {
|
|
142
147
|
config
|
|
143
148
|
} = useConfig();
|
|
144
|
-
const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${
|
|
149
|
+
const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${blockType}`;
|
|
145
150
|
const clientSchemaMap = featureClientSchemaMap['blocks'];
|
|
146
151
|
const blocksField = clientSchemaMap?.[componentMapRenderedBlockPath]?.[0];
|
|
147
152
|
const blockOrSlug = blocksField?.blocks?.[0];
|
|
@@ -165,7 +170,6 @@ export const InlineBlockComponent = props => {
|
|
|
165
170
|
}, [editor, nodeKey]);
|
|
166
171
|
const blockDisplayName = clientBlock?.labels?.singular ? getTranslation(clientBlock?.labels.singular, i18n) : clientBlock?.slug;
|
|
167
172
|
const onChangeAbortControllerRef = useRef(new AbortController());
|
|
168
|
-
const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${clientBlock?.slug}.fields`;
|
|
169
173
|
// Initial state for newly created blocks
|
|
170
174
|
useEffect(() => {
|
|
171
175
|
const abortController = new AbortController();
|
|
@@ -190,7 +194,6 @@ export const InlineBlockComponent = props => {
|
|
|
190
194
|
}),
|
|
191
195
|
globalSlug,
|
|
192
196
|
initialBlockData: formData,
|
|
193
|
-
initialBlockFormState: formData,
|
|
194
197
|
operation: 'update',
|
|
195
198
|
readOnly: !isEditable,
|
|
196
199
|
renderAllFields: true,
|
|
@@ -198,9 +201,9 @@ export const InlineBlockComponent = props => {
|
|
|
198
201
|
signal: abortController.signal
|
|
199
202
|
});
|
|
200
203
|
if (state) {
|
|
201
|
-
const newFormStateData =
|
|
204
|
+
const newFormStateData = reduceFormStateToBlockData(deepCopyObjectSimpleWithoutReactComponents(state, {
|
|
202
205
|
excludeFiles: true
|
|
203
|
-
})
|
|
206
|
+
}));
|
|
204
207
|
// Things like default values may come back from the server => update the node with the new data
|
|
205
208
|
editor.update(() => {
|
|
206
209
|
const node = $getNodeByKey(nodeKey);
|
|
@@ -224,13 +227,13 @@ export const InlineBlockComponent = props => {
|
|
|
224
227
|
}
|
|
225
228
|
}
|
|
226
229
|
};
|
|
227
|
-
if (formData && !initialState) {
|
|
230
|
+
if (clientBlock && formData && !initialState) {
|
|
228
231
|
void awaitInitialState();
|
|
229
232
|
}
|
|
230
233
|
return () => {
|
|
231
234
|
abortAndIgnore(abortController);
|
|
232
235
|
};
|
|
233
|
-
}, [getFormState, editor, nodeKey, isEditable, CustomLabelFromProps, CustomBlockFromProps, schemaFieldsPath, id, formData, initialState, collectionSlug, globalSlug, getDocPreferences, parentDocumentFields]);
|
|
236
|
+
}, [getFormState, editor, nodeKey, isEditable, CustomLabelFromProps, CustomBlockFromProps, schemaFieldsPath, id, formData, initialState, collectionSlug, globalSlug, getDocPreferences, parentDocumentFields, clientBlock]);
|
|
234
237
|
/**
|
|
235
238
|
* HANDLE ONCHANGE
|
|
236
239
|
*/
|
|
@@ -241,11 +244,15 @@ export const InlineBlockComponent = props => {
|
|
|
241
244
|
abortAndIgnore(onChangeAbortControllerRef.current);
|
|
242
245
|
const controller = new AbortController();
|
|
243
246
|
onChangeAbortControllerRef.current = controller;
|
|
247
|
+
const blockData = reduceFormStateToBlockData(deepCopyObjectSimpleWithoutReactComponents(prevFormState, {
|
|
248
|
+
excludeFiles: true
|
|
249
|
+
}), formDataRef.current);
|
|
244
250
|
const {
|
|
245
251
|
state: state_0
|
|
246
252
|
} = await getFormState({
|
|
247
253
|
id,
|
|
248
254
|
collectionSlug,
|
|
255
|
+
data: blockData,
|
|
249
256
|
docPermissions: {
|
|
250
257
|
fields: true
|
|
251
258
|
},
|
|
@@ -255,7 +262,7 @@ export const InlineBlockComponent = props => {
|
|
|
255
262
|
}),
|
|
256
263
|
formState: prevFormState,
|
|
257
264
|
globalSlug,
|
|
258
|
-
|
|
265
|
+
initialBlockData: blockData,
|
|
259
266
|
operation: 'update',
|
|
260
267
|
readOnly: !isEditable,
|
|
261
268
|
renderAllFields: submit ? true : false,
|
|
@@ -293,8 +300,9 @@ export const InlineBlockComponent = props => {
|
|
|
293
300
|
/**
|
|
294
301
|
* HANDLE FORM SUBMIT
|
|
295
302
|
*/
|
|
296
|
-
const onFormSubmit = useCallback(
|
|
297
|
-
newData_0
|
|
303
|
+
const onFormSubmit = useCallback(formState => {
|
|
304
|
+
const newData_0 = reduceFormStateToBlockData(formState, formDataRef.current);
|
|
305
|
+
newData_0.blockType = blockType;
|
|
298
306
|
editor.update(() => {
|
|
299
307
|
const node_0 = $getNodeByKey(nodeKey);
|
|
300
308
|
if (node_0 && $isInlineBlockNode(node_0)) {
|
|
@@ -306,7 +314,7 @@ export const InlineBlockComponent = props => {
|
|
|
306
314
|
{
|
|
307
315
|
tag: SKIP_DOM_SELECTION_TAG
|
|
308
316
|
});
|
|
309
|
-
}, [editor, nodeKey
|
|
317
|
+
}, [blockType, editor, nodeKey]);
|
|
310
318
|
const {
|
|
311
319
|
headerActions,
|
|
312
320
|
submitRef
|
|
@@ -396,8 +404,8 @@ export const InlineBlockComponent = props => {
|
|
|
396
404
|
fields: clientBlock?.fields,
|
|
397
405
|
initialState: initialState || {},
|
|
398
406
|
onChange: [onChange],
|
|
399
|
-
onSubmit:
|
|
400
|
-
onFormSubmit(formState_1
|
|
407
|
+
onSubmit: formState_1 => {
|
|
408
|
+
onFormSubmit(formState_1);
|
|
401
409
|
toggleDrawer();
|
|
402
410
|
},
|
|
403
411
|
uuid: formUuid,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useLexicalComposerContext","useLexicalEditable","getTranslation","Button","Drawer","EditDepthProvider","Form","formatDrawerSlug","RenderFields","ShimmerEffect","useConfig","useDocumentForm","useDocumentInfo","useEditDepth","useServerFunctions","useTranslation","abortAndIgnore","$getNodeByKey","SKIP_DOM_SELECTION_TAG","deepCopyObjectSimpleWithoutReactComponents","reduceFieldsToValues","React","createContext","useCallback","useEffect","useMemo","useRef","v4","uuid","useEditorConfigContext","RegisterFormSubmit","useDrawerSubmit","useLexicalDrawer","$isInlineBlockNode","InlineBlockComponentContext","initialState","useInlineBlockComponentContext","use","InlineBlockComponent","props","cacheBuster","className","baseClass","CustomBlock","CustomBlockFromProps","CustomLabel","CustomLabelFromProps","formData","nodeKey","editor","isEditable","i18n","t","createdInlineBlock","fieldProps","featureClientSchemaMap","initialLexicalFormState","schemaPath","setCreatedInlineBlock","uuidFromContext","fields","parentDocumentFields","getFormState","editDepth","firstTimeDrawer","setInitialState","useState","cachedFormState","id","formState","Object","fromEntries","entries","map","fieldName","fieldState","initialValue","value","hasMounted","prevCacheBuster","current","formUuid","setCustomLabel","undefined","customComponents","BlockLabel","setCustomBlock","Block","resolvedCustomBlock","_jsx","isEditor","isJSXConverter","resolvedCustomLabel","drawerSlug","slug","depth","toggleDrawer","inlineBlockElemElemRef","collectionSlug","getDocPreferences","globalSlug","config","componentMapRenderedBlockPath","blockType","clientSchemaMap","blocksField","blockOrSlug","blocks","clientBlock","blocksMap","clientBlockFields","getKey","length","removeInlineBlock","update","remove","blockDisplayName","labels","singular","onChangeAbortControllerRef","AbortController","schemaFieldsPath","abortController","awaitInitialState","state","data","docPermissions","docPreferences","documentFormState","excludeFiles","initialBlockData","initialBlockFormState","operation","readOnly","renderAllFields","signal","newFormStateData","node","newData","setFields","tag","onChange","prevFormState","submit","controller","isStateOutOfSync","keys","some","key","onFormSubmit","headerActions","submitRef","RemoveButton","buttonStyle","disabled","icon","onClick","e","preventDefault","stopPropagation","round","size","tooltip","label","EditButton","el","InlineBlockContainer","children","filter","Boolean","join","onKeyDown","role","tabIndex","ref","Label","_jsxs","beforeSubmit","disableValidationOnSubmit","onSubmit","title","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","height","width"],"sources":["../../../../../src/features/blocks/client/componentInline/index.tsx"],"sourcesContent":["'use client'\n\nimport type { BlocksFieldClient, ClientBlock, Data, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Drawer,\n EditDepthProvider,\n Form,\n formatDrawerSlug,\n RenderFields,\n ShimmerEffect,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey, SKIP_DOM_SELECTION_TAG } from 'lexical'\n\nimport './index.css'\nimport '../../../../utilities/fieldsDrawer/index.css'\n\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ViewMapInlineBlockComponentProps } from '../../../../types/index.js'\nimport type { InlineBlockFields } from '../../server/schema.js'\nimport type { BlockComponentProps } from '../component/index.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport {\n RegisterFormSubmit,\n useDrawerSubmit,\n} from '../../../../utilities/fieldsDrawer/useDrawerSubmit.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isInlineBlockNode } from '../nodes/InlineBlocksNode.js'\n\nexport type InlineBlockComponentProps<\n TFormData extends Record<string, unknown> = InlineBlockFields,\n> = {\n readonly CustomBlock?: React.FC<ViewMapInlineBlockComponentProps>\n readonly CustomLabel?: React.FC<ViewMapInlineBlockComponentProps>\n} & Pick<BlockComponentProps<TFormData>, 'cacheBuster' | 'className' | 'formData' | 'nodeKey'>\n\nexport type InlineBlockComponentContextType = {\n EditButton?: React.FC\n initialState: false | FormState | undefined\n InlineBlockContainer?: React.FC<{ children: React.ReactNode }>\n Label?: React.FC\n nodeKey?: string\n RemoveButton?: React.FC\n}\n\nconst InlineBlockComponentContext = createContext<InlineBlockComponentContextType>({\n initialState: false,\n})\n\nexport const useInlineBlockComponentContext = () => React.use(InlineBlockComponentContext)\n\nexport const InlineBlockComponent: React.FC<InlineBlockComponentProps<InlineBlockFields>> = (\n props,\n) => {\n const {\n cacheBuster,\n className: baseClass,\n CustomBlock: CustomBlockFromProps,\n CustomLabel: CustomLabelFromProps,\n formData,\n nodeKey,\n } = props\n\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n const { i18n, t } = useTranslation<object, string>()\n const {\n createdInlineBlock,\n fieldProps: { featureClientSchemaMap, initialLexicalFormState, schemaPath },\n setCreatedInlineBlock,\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n const { fields: parentDocumentFields } = useDocumentForm()\n\n const { getFormState } = useServerFunctions()\n const editDepth = useEditDepth()\n const firstTimeDrawer = useRef(false)\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(() => {\n // Initial form state that was calculated server-side. May have stale values\n const cachedFormState = initialLexicalFormState?.[formData.id]?.formState\n if (!cachedFormState) {\n return false\n }\n\n // Merge current formData values into the cached form state\n // This ensures that when the component remounts (e.g., due to view changes), we don't lose user edits\n return Object.fromEntries(\n Object.entries(cachedFormState).map(([fieldName, fieldState]) => [\n fieldName,\n fieldName in formData\n ? {\n ...fieldState,\n initialValue: formData[fieldName],\n value: formData[fieldName],\n }\n : fieldState,\n ]),\n )\n })\n\n const hasMounted = useRef(false)\n const prevCacheBuster = useRef(cacheBuster)\n useEffect(() => {\n if (hasMounted.current) {\n if (prevCacheBuster.current !== cacheBuster) {\n setInitialState(false)\n }\n prevCacheBuster.current = cacheBuster\n } else {\n hasMounted.current = true\n }\n }, [cacheBuster])\n\n const [formUuid] = React.useState(() => uuid())\n\n // Server-rendered custom components (from admin.components, NOT viewMap).\n // When viewMap components exist, we render them directly with formData instead.\n const [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomLabelFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.BlockLabel ?? undefined\n })\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomBlockFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.Block ?? undefined\n })\n\n const resolvedCustomBlock = useMemo(() => {\n if (CustomBlockFromProps) {\n return (\n <CustomBlockFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call\n useInlineBlockComponentContext={useInlineBlockComponentContext}\n />\n )\n }\n return CustomBlock\n }, [CustomBlockFromProps, baseClass, formData, nodeKey, CustomBlock])\n\n const resolvedCustomLabel = useMemo(() => {\n if (CustomLabelFromProps) {\n return (\n <CustomLabelFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call\n useInlineBlockComponentContext={useInlineBlockComponentContext}\n />\n )\n }\n return CustomLabel\n }, [CustomLabelFromProps, baseClass, formData, nodeKey, CustomLabel])\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-inlineBlocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { config } = useConfig()\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${formData.blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient | undefined = clientSchemaMap?.[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient | undefined\n\n const blockOrSlug = blocksField?.blocks?.[0]\n const clientBlock: ClientBlock | undefined =\n typeof blockOrSlug === 'string' ? config.blocksMap[blockOrSlug] : blockOrSlug\n\n const clientBlockFields = clientBlock?.fields ?? []\n\n // Open drawer on \"mount\"\n useEffect(() => {\n if (!firstTimeDrawer.current && createdInlineBlock?.getKey() === nodeKey) {\n // > 2 because they always have \"id\" and \"blockName\" fields\n if (clientBlockFields.length > 2) {\n toggleDrawer()\n }\n setCreatedInlineBlock?.(undefined)\n firstTimeDrawer.current = true\n }\n }, [clientBlockFields.length, createdInlineBlock, nodeKey, setCreatedInlineBlock, toggleDrawer])\n\n const removeInlineBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock?.labels.singular, i18n)\n : clientBlock?.slug\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${clientBlock?.slug}.fields`\n\n // Initial state for newly created blocks\n useEffect(() => {\n const abortController = new AbortController()\n\n const awaitInitialState = async () => {\n /*\n * This will only run if a new block is created. For all existing blocks that are loaded when the document is loaded, or when the form is saved,\n * this is not run, as the lexical field RSC will fetch the state server-side and pass it to the client. That way, we avoid unnecessary client-side\n * requests. Though for newly created blocks, we need to fetch the state client-side, as the server doesn't know about the block yet.\n */\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: formData,\n docPermissions: { fields: true },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n globalSlug,\n initialBlockData: formData,\n initialBlockFormState: formData,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n const newFormStateData: InlineBlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state, { excludeFiles: true }),\n true,\n ) as InlineBlockFields\n\n // Things like default values may come back from the server => update the node with the new data\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = formData.blockType\n\n node.setFields(newData, true)\n }\n },\n // Without this, the outer editor's reconciler resets DOM selection\n // back into its own root, kicking focus out of any nested richText.\n { tag: SKIP_DOM_SELECTION_TAG },\n )\n\n setInitialState(state)\n if (!CustomLabelFromProps) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n editor,\n nodeKey,\n isEditable,\n CustomLabelFromProps,\n CustomBlockFromProps,\n schemaFieldsPath,\n id,\n formData,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n /**\n * HANDLE ONCHANGE\n */\n const onChange = useCallback(\n async ({ formState: prevFormState, submit }: { formState: FormState; submit?: boolean }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n if (submit) {\n if (!CustomLabelFromProps) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n\n return state\n },\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n isEditable,\n schemaFieldsPath,\n CustomBlockFromProps,\n CustomLabelFromProps,\n ],\n )\n // cleanup effect\n useEffect(() => {\n const isStateOutOfSync = (formData: InlineBlockFields, initialState: FormState) => {\n return Object.keys(initialState).some(\n (key) => initialState[key] && formData[key] !== initialState[key].value,\n )\n }\n\n return () => {\n // If the component is unmounted (either via removeInlineBlock or via lexical itself) and the form state got changed before,\n // we need to reset the initial state to force a re-fetch of the initial state when it gets mounted again (e.g. via lexical history undo).\n // Otherwise it would use an outdated initial state.\n if (initialState && isStateOutOfSync(formData, initialState)) {\n setInitialState(false)\n }\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [formData, initialState])\n\n /**\n * HANDLE FORM SUBMIT\n */\n const onFormSubmit = useCallback(\n (formState: FormState, newData: Data) => {\n newData.blockType = formData.blockType\n\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData as InlineBlockFields, true)\n }\n },\n // Without this, the outer editor's reconciler resets DOM selection\n // back into its own root, kicking focus out of any nested richText.\n { tag: SKIP_DOM_SELECTION_TAG },\n )\n },\n [editor, nodeKey, formData],\n )\n\n const { headerActions, submitRef } = useDrawerSubmit()\n\n const RemoveButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n e.stopPropagation()\n removeInlineBlock()\n }}\n round\n size=\"medium\"\n tooltip={t('lexical:blocks:inlineBlocks:remove', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, removeInlineBlock, t],\n )\n\n const EditButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__editButton`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"edit\"\n onClick={() => {\n toggleDrawer()\n }}\n round\n size=\"medium\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, t, toggleDrawer],\n )\n\n const InlineBlockContainer = useMemo(\n () =>\n ({ children, className }: { children: React.ReactNode; className?: string }) => (\n <div\n className={[`${baseClass}__container`, baseClass + '-' + formData.blockType, className]\n .filter(Boolean)\n .join(' ')}\n {...(isEditable\n ? {\n onClick: () => toggleDrawer(),\n onKeyDown: (e: React.KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n toggleDrawer()\n }\n },\n role: 'button',\n tabIndex: 0,\n }\n : {})}\n ref={inlineBlockElemElemRef}\n >\n {children}\n </div>\n ),\n [baseClass, formData.blockType, isEditable, toggleDrawer],\n )\n\n const Label = useMemo(() => {\n if (resolvedCustomLabel) {\n return () => resolvedCustomLabel\n } else {\n return () => (\n <div>{clientBlock?.labels ? getTranslation(clientBlock?.labels.singular, i18n) : ''}</div>\n )\n }\n }, [resolvedCustomLabel, clientBlock?.labels, i18n])\n\n if (!clientBlock) {\n return (\n <InlineBlockContainer className={`${baseClass}-not-found`}>\n <span>Error: Block '{formData.blockType}' not found</span>\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )\n }\n\n return (\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer\n return await onChange({ formState, submit: true })\n },\n ]}\n disableValidationOnSubmit\n el=\"div\"\n fields={clientBlock?.fields}\n initialState={initialState || {}}\n onChange={[onChange]}\n onSubmit={(formState, data) => {\n onFormSubmit(formState, data)\n toggleDrawer()\n }}\n uuid={formUuid}\n >\n <EditDepthProvider>\n <Drawer\n className={''}\n headerActions={headerActions}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${formData?.id ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <div className=\"fields-drawer\">\n <RenderFields\n fields={clientBlock?.fields}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <RegisterFormSubmit submitRef={submitRef} />\n </div>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n {resolvedCustomBlock ? (\n <InlineBlockComponentContext\n value={{\n EditButton,\n initialState,\n InlineBlockContainer,\n Label,\n nodeKey,\n RemoveButton,\n }}\n >\n {resolvedCustomBlock}\n </InlineBlockComponentContext>\n ) : (\n <InlineBlockContainer>\n {initialState ? <Label /> : <ShimmerEffect height=\"15px\" width=\"40px\" />}\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )}\n </Form>\n )\n}\n"],"mappings":"AAAA;;;AAIA,SAASA,yBAAyB,QAAQ;AAC1C,SAASC,kBAAkB,QAAQ;AACnC,SAASC,cAAc,QAAQ;AAC/B,SACEC,MAAM,EACNC,MAAM,EACNC,iBAAiB,EACjBC,IAAI,EACJC,gBAAgB,EAChBC,YAAY,EACZC,aAAa,EACbC,SAAS,EACTC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,kBAAkB,EAClBC,cAAc,QACT;AACP,SAASC,cAAc,QAAQ;AAC/B,SAASC,aAAa,EAAEC,sBAAsB,QAAQ;AAEtD,OAAO;AACP,OAAO;AAEP,SAASC,0CAA0C,EAAEC,oBAAoB,QAAQ;AACjF,OAAOC,KAAA,IAASC,aAAa,EAAEC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ;AAC9E,SAASC,EAAA,IAAMC,IAAI,QAAQ;AAM3B,SAASC,sBAAsB,QAAQ;AACvC,SACEC,kBAAkB,EAClBC,eAAe,QACV;AACP,SAASC,gBAAgB,QAAQ;AACjC,SAASC,kB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pBsC,QAAA,EAAUA,CAAC9G,WAAA,EAAWwD,IAAA;MACpBwB,YAAA,CAAahF,WAAA,EAAWwD,IAAA;MACxB7B,YAAA;IACF;IACApE,IAAA,EAAMqD,QAAA;4BAENQ,IAAA,CAACpF,iBAAA;gBACC,aAAAoF,IAAA,CAACrF,MAAA;QACCqC,SAAA,EAAW;QACX6G,aAAA,EAAeA,aAAA;QACfxD,IAAA,EAAMD,UAAA;QACNuF,KAAA,EAAOhI,CAAA,CAAE,+BAA+BL,QAAA,EAAUqB,EAAA,GAAK,SAAS,UAAU,EAAE;UAC1E+F,KAAA,EAAO/C,gBAAA,IAAoBhE,CAAA,CAAE;QAC/B;kBAECjB,YAAA,gBACC6I,KAAA,CAAC;UAAIvI,SAAA,EAAU;kCACbgD,IAAA,CAACjF,YAAA;YACCoD,MAAA,EAAQgD,WAAA,EAAahD,MAAA;YACrByH,WAAW;YACXC,eAAA,EAAgB;YAChBC,UAAA,EAAW;YACXC,gBAAA,EAAkB/D,gBAAA;YAClBgE,WAAA,EAAa;YACbpD,QAAA,EAAU,CAACnF;2BAEbuC,IAAA,CAAC3D,kBAAA;YAAmByH,SAAA,EAAWA;;aAE/B;;QAGP/D,mBAAA,gBACCC,IAAA,CAACvD,2BAAA;MACC2C,KAAA,EAAO;QACLuF,UAAA;QACAjI,YAAA;QACAmI,oBAAA;QACAS,KAAA;QACA/H,OAAA;QACAwG;MACF;gBAEChE;sBAGHwF,KAAA,CAACV,oBAAA;iBACEnI,YAAA,gBAAesD,IAAA,CAACsF,KAAA,qBAAWtF,IAAA,CAAChF,aAAA;QAAciL,MAAA,EAAO;QAAOC,KAAA,EAAM;UAC9DzI,UAAA,gBACCuC,IAAA,CAAC;QAAIhD,SAAA,EAAW,GAAGC,SAAA,WAAoB;kBACrC,aAAA+C,IAAA,CAAC+D,YAAA;WAED;;;AAKd","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["useLexicalComposerContext","useLexicalEditable","getTranslation","Button","Drawer","EditDepthProvider","Form","formatDrawerSlug","RenderFields","ShimmerEffect","useConfig","useDocumentForm","useDocumentInfo","useEditDepth","useServerFunctions","useTranslation","abortAndIgnore","$getNodeByKey","SKIP_DOM_SELECTION_TAG","deepCopyObjectSimpleWithoutReactComponents","React","createContext","useCallback","useEffect","useMemo","useRef","v4","uuid","useEditorConfigContext","RegisterFormSubmit","useDrawerSubmit","useLexicalDrawer","getCachedFormStateIfDataMatches","reduceFormStateToBlockData","$isInlineBlockNode","InlineBlockComponentContext","initialState","useInlineBlockComponentContext","use","InlineBlockComponent","props","cacheBuster","className","baseClass","CustomBlock","CustomBlockFromProps","CustomLabel","CustomLabelFromProps","formData","nodeKey","editor","isEditable","i18n","t","createdInlineBlock","fieldProps","featureClientSchemaMap","initialLexicalFormState","schemaPath","setCreatedInlineBlock","uuidFromContext","fields","parentDocumentFields","getFormState","editDepth","firstTimeDrawer","blockType","formDataRef","current","schemaFieldsPath","setInitialState","useState","cachedState","id","cachedFormState","formState","cachedSchemaPath","currentSchemaPath","hasMounted","prevCacheBuster","formUuid","setCustomLabel","undefined","customComponents","BlockLabel","setCustomBlock","Block","resolvedCustomBlock","_jsx","isEditor","isJSXConverter","resolvedCustomLabel","drawerSlug","slug","depth","toggleDrawer","inlineBlockElemElemRef","collectionSlug","getDocPreferences","globalSlug","config","componentMapRenderedBlockPath","clientSchemaMap","blocksField","blockOrSlug","blocks","clientBlock","blocksMap","clientBlockFields","getKey","length","removeInlineBlock","update","remove","blockDisplayName","labels","singular","onChangeAbortControllerRef","AbortController","abortController","awaitInitialState","state","data","docPermissions","docPreferences","documentFormState","excludeFiles","initialBlockData","operation","readOnly","renderAllFields","signal","newFormStateData","node","newData","setFields","tag","onChange","prevFormState","submit","controller","blockData","isStateOutOfSync","Object","keys","some","key","value","onFormSubmit","headerActions","submitRef","RemoveButton","buttonStyle","disabled","icon","onClick","e","preventDefault","stopPropagation","round","size","tooltip","label","EditButton","el","InlineBlockContainer","children","filter","Boolean","join","onKeyDown","role","tabIndex","ref","Label","_jsxs","beforeSubmit","disableValidationOnSubmit","onSubmit","title","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","height","width"],"sources":["../../../../../src/features/blocks/client/componentInline/index.tsx"],"sourcesContent":["'use client'\n\nimport type { BlocksFieldClient, ClientBlock, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Drawer,\n EditDepthProvider,\n Form,\n formatDrawerSlug,\n RenderFields,\n ShimmerEffect,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey, SKIP_DOM_SELECTION_TAG } from 'lexical'\n\nimport './index.css'\nimport '../../../../utilities/fieldsDrawer/index.css'\n\nimport { deepCopyObjectSimpleWithoutReactComponents } from 'payload/shared'\nimport React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ViewMapInlineBlockComponentProps } from '../../../../types/index.js'\nimport type { InlineBlockFields } from '../../server/schema.js'\nimport type { BlockComponentProps } from '../component/index.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport {\n RegisterFormSubmit,\n useDrawerSubmit,\n} from '../../../../utilities/fieldsDrawer/useDrawerSubmit.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport {\n getCachedFormStateIfDataMatches,\n reduceFormStateToBlockData,\n} from '../getCachedFormStateIfDataMatches.js'\nimport { $isInlineBlockNode } from '../nodes/InlineBlocksNode.js'\n\nexport type InlineBlockComponentProps<\n TFormData extends Record<string, unknown> = InlineBlockFields,\n> = {\n readonly CustomBlock?: React.FC<ViewMapInlineBlockComponentProps>\n readonly CustomLabel?: React.FC<ViewMapInlineBlockComponentProps>\n} & Pick<BlockComponentProps<TFormData>, 'cacheBuster' | 'className' | 'formData' | 'nodeKey'>\n\nexport type InlineBlockComponentContextType = {\n EditButton?: React.FC\n initialState: false | FormState | undefined\n InlineBlockContainer?: React.FC<{ children: React.ReactNode }>\n Label?: React.FC\n nodeKey?: string\n RemoveButton?: React.FC\n}\n\nconst InlineBlockComponentContext = createContext<InlineBlockComponentContextType>({\n initialState: false,\n})\n\nexport const useInlineBlockComponentContext = () => React.use(InlineBlockComponentContext)\n\nexport const InlineBlockComponent: React.FC<InlineBlockComponentProps<InlineBlockFields>> = (\n props,\n) => {\n const {\n cacheBuster,\n className: baseClass,\n CustomBlock: CustomBlockFromProps,\n CustomLabel: CustomLabelFromProps,\n formData,\n nodeKey,\n } = props\n\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n const { i18n, t } = useTranslation<object, string>()\n const {\n createdInlineBlock,\n fieldProps: { featureClientSchemaMap, initialLexicalFormState, schemaPath },\n setCreatedInlineBlock,\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n const { fields: parentDocumentFields } = useDocumentForm()\n\n const { getFormState } = useServerFunctions()\n const editDepth = useEditDepth()\n const firstTimeDrawer = useRef(false)\n const blockType = formData.blockType\n const formDataRef = useRef(formData)\n formDataRef.current = formData\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${blockType}.fields`\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(() => {\n // Initial form state that was calculated server-side. May have stale values\n const cachedState = initialLexicalFormState?.[formData.id]\n const cachedFormState = cachedState?.formState\n if (!cachedFormState) {\n return false\n }\n\n return getCachedFormStateIfDataMatches({\n cachedFormState,\n cachedSchemaPath: cachedState.schemaPath,\n currentSchemaPath: schemaFieldsPath,\n formData,\n })\n })\n\n const hasMounted = useRef(false)\n const prevCacheBuster = useRef(cacheBuster)\n useEffect(() => {\n if (hasMounted.current) {\n if (prevCacheBuster.current !== cacheBuster) {\n setInitialState(false)\n }\n prevCacheBuster.current = cacheBuster\n } else {\n hasMounted.current = true\n }\n }, [cacheBuster])\n\n const [formUuid] = React.useState(() => uuid())\n\n // Server-rendered custom components (from admin.components, NOT viewMap).\n // When viewMap components exist, we render them directly with formData instead.\n const [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomLabelFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.BlockLabel ?? undefined\n })\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomBlockFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.Block ?? undefined\n })\n\n const resolvedCustomBlock = useMemo(() => {\n if (CustomBlockFromProps) {\n return (\n <CustomBlockFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call\n useInlineBlockComponentContext={useInlineBlockComponentContext}\n />\n )\n }\n return CustomBlock\n }, [CustomBlockFromProps, baseClass, formData, nodeKey, CustomBlock])\n\n const resolvedCustomLabel = useMemo(() => {\n if (CustomLabelFromProps) {\n return (\n <CustomLabelFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call\n useInlineBlockComponentContext={useInlineBlockComponentContext}\n />\n )\n }\n return CustomLabel\n }, [CustomLabelFromProps, baseClass, formData, nodeKey, CustomLabel])\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-inlineBlocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { config } = useConfig()\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient | undefined = clientSchemaMap?.[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient | undefined\n\n const blockOrSlug = blocksField?.blocks?.[0]\n const clientBlock: ClientBlock | undefined =\n typeof blockOrSlug === 'string' ? config.blocksMap[blockOrSlug] : blockOrSlug\n\n const clientBlockFields = clientBlock?.fields ?? []\n\n // Open drawer on \"mount\"\n useEffect(() => {\n if (!firstTimeDrawer.current && createdInlineBlock?.getKey() === nodeKey) {\n // > 2 because they always have \"id\" and \"blockName\" fields\n if (clientBlockFields.length > 2) {\n toggleDrawer()\n }\n setCreatedInlineBlock?.(undefined)\n firstTimeDrawer.current = true\n }\n }, [clientBlockFields.length, createdInlineBlock, nodeKey, setCreatedInlineBlock, toggleDrawer])\n\n const removeInlineBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock?.labels.singular, i18n)\n : clientBlock?.slug\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n\n // Initial state for newly created blocks\n useEffect(() => {\n const abortController = new AbortController()\n\n const awaitInitialState = async () => {\n /*\n * This will only run if a new block is created. For all existing blocks that are loaded when the document is loaded, or when the form is saved,\n * this is not run, as the lexical field RSC will fetch the state server-side and pass it to the client. That way, we avoid unnecessary client-side\n * requests. Though for newly created blocks, we need to fetch the state client-side, as the server doesn't know about the block yet.\n */\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: formData,\n docPermissions: { fields: true },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n globalSlug,\n initialBlockData: formData,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n const newFormStateData = reduceFormStateToBlockData(\n deepCopyObjectSimpleWithoutReactComponents(state, { excludeFiles: true }),\n ) as InlineBlockFields\n\n // Things like default values may come back from the server => update the node with the new data\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = formData.blockType\n\n node.setFields(newData, true)\n }\n },\n // Without this, the outer editor's reconciler resets DOM selection\n // back into its own root, kicking focus out of any nested richText.\n { tag: SKIP_DOM_SELECTION_TAG },\n )\n\n setInitialState(state)\n if (!CustomLabelFromProps) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n }\n\n if (clientBlock && formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n editor,\n nodeKey,\n isEditable,\n CustomLabelFromProps,\n CustomBlockFromProps,\n schemaFieldsPath,\n id,\n formData,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n clientBlock,\n ])\n\n /**\n * HANDLE ONCHANGE\n */\n const onChange = useCallback(\n async ({ formState: prevFormState, submit }: { formState: FormState; submit?: boolean }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n const blockData = reduceFormStateToBlockData(\n deepCopyObjectSimpleWithoutReactComponents(prevFormState, { excludeFiles: true }),\n formDataRef.current,\n )\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: blockData,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n formState: prevFormState,\n globalSlug,\n initialBlockData: blockData,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n if (submit) {\n if (!CustomLabelFromProps) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n\n return state\n },\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n isEditable,\n schemaFieldsPath,\n CustomBlockFromProps,\n CustomLabelFromProps,\n ],\n )\n // cleanup effect\n useEffect(() => {\n const isStateOutOfSync = (formData: InlineBlockFields, initialState: FormState) => {\n return Object.keys(initialState).some(\n (key) => initialState[key] && formData[key] !== initialState[key].value,\n )\n }\n\n return () => {\n // If the component is unmounted (either via removeInlineBlock or via lexical itself) and the form state got changed before,\n // we need to reset the initial state to force a re-fetch of the initial state when it gets mounted again (e.g. via lexical history undo).\n // Otherwise it would use an outdated initial state.\n if (initialState && isStateOutOfSync(formData, initialState)) {\n setInitialState(false)\n }\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [formData, initialState])\n\n /**\n * HANDLE FORM SUBMIT\n */\n const onFormSubmit = useCallback(\n (formState: FormState) => {\n const newData = reduceFormStateToBlockData(formState, formDataRef.current)\n newData.blockType = blockType\n\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData as InlineBlockFields, true)\n }\n },\n // Without this, the outer editor's reconciler resets DOM selection\n // back into its own root, kicking focus out of any nested richText.\n { tag: SKIP_DOM_SELECTION_TAG },\n )\n },\n [blockType, editor, nodeKey],\n )\n\n const { headerActions, submitRef } = useDrawerSubmit()\n\n const RemoveButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n e.stopPropagation()\n removeInlineBlock()\n }}\n round\n size=\"medium\"\n tooltip={t('lexical:blocks:inlineBlocks:remove', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, removeInlineBlock, t],\n )\n\n const EditButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__editButton`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"edit\"\n onClick={() => {\n toggleDrawer()\n }}\n round\n size=\"medium\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, t, toggleDrawer],\n )\n\n const InlineBlockContainer = useMemo(\n () =>\n ({ children, className }: { children: React.ReactNode; className?: string }) => (\n <div\n className={[`${baseClass}__container`, baseClass + '-' + formData.blockType, className]\n .filter(Boolean)\n .join(' ')}\n {...(isEditable\n ? {\n onClick: () => toggleDrawer(),\n onKeyDown: (e: React.KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n toggleDrawer()\n }\n },\n role: 'button',\n tabIndex: 0,\n }\n : {})}\n ref={inlineBlockElemElemRef}\n >\n {children}\n </div>\n ),\n [baseClass, formData.blockType, isEditable, toggleDrawer],\n )\n\n const Label = useMemo(() => {\n if (resolvedCustomLabel) {\n return () => resolvedCustomLabel\n } else {\n return () => (\n <div>{clientBlock?.labels ? getTranslation(clientBlock?.labels.singular, i18n) : ''}</div>\n )\n }\n }, [resolvedCustomLabel, clientBlock?.labels, i18n])\n\n if (!clientBlock) {\n return (\n <InlineBlockContainer className={`${baseClass}-not-found`}>\n <span>Error: Block '{formData.blockType}' not found</span>\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )\n }\n\n return (\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer\n return await onChange({ formState, submit: true })\n },\n ]}\n disableValidationOnSubmit\n el=\"div\"\n fields={clientBlock?.fields}\n initialState={initialState || {}}\n onChange={[onChange]}\n onSubmit={(formState) => {\n onFormSubmit(formState)\n toggleDrawer()\n }}\n uuid={formUuid}\n >\n <EditDepthProvider>\n <Drawer\n className={''}\n headerActions={headerActions}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${formData?.id ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <div className=\"fields-drawer\">\n <RenderFields\n fields={clientBlock?.fields}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <RegisterFormSubmit submitRef={submitRef} />\n </div>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n {resolvedCustomBlock ? (\n <InlineBlockComponentContext\n value={{\n EditButton,\n initialState,\n InlineBlockContainer,\n Label,\n nodeKey,\n RemoveButton,\n }}\n >\n {resolvedCustomBlock}\n </InlineBlockComponentContext>\n ) : (\n <InlineBlockContainer>\n {initialState ? <Label /> : <ShimmerEffect height=\"15px\" width=\"40px\" />}\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )}\n </Form>\n )\n}\n"],"mappings":"AAAA;;;AAIA,SAASA,yBAAyB,QAAQ;AAC1C,SAASC,kBAAkB,QAAQ;AACnC,SAASC,cAAc,QAAQ;AAC/B,SACEC,MAAM,EACNC,MAAM,EACNC,iBAAiB,EACjBC,IAAI,EACJC,gBAAgB,EAChBC,YAAY,EACZC,aAAa,EACbC,SAAS,EACTC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,kBAAkB,EAClBC,cAAc,QACT;AACP,SAASC,cAAc,QAAQ;AAC/B,SAASC,aAAa,EAAEC,sBAAsB,QAAQ;AAEtD,OAAO;AACP,OAAO;AAEP,SAASC,0CAA0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,YAAA;QACAiI,oBAAA;QACAS,KAAA;QACA7H,OAAA;QACAsG;MACF;gBAEChE;sBAGHwF,KAAA,CAACV,oBAAA;iBACEjI,YAAA,gBAAeoD,IAAA,CAACsF,KAAA,qBAAWtF,IAAA,CAAC/E,aAAA;QAAcgL,MAAA,EAAO;QAAOC,KAAA,EAAM;UAC9DvI,UAAA,gBACCqC,IAAA,CAAC;QAAI9C,SAAA,EAAW,GAAGC,SAAA,WAAoB;kBACrC,aAAA6C,IAAA,CAAC+D,YAAA;WAED;;;AAKd","ignoreList":[]}
|
|
@@ -6,5 +6,5 @@ import React from 'react';
|
|
|
6
6
|
* Priority for URL: images.icon > images.thumbnail > imageURL (deprecated)
|
|
7
7
|
* Priority for alt: images.icon.alt > images.thumbnail.alt > imageAltText (deprecated)
|
|
8
8
|
*/
|
|
9
|
-
export declare function getBlockImageComponent(block: ClientBlock, fallback: React.ElementType):
|
|
9
|
+
export declare function getBlockImageComponent(block: ClientBlock, fallback: React.ElementType): (() => React.JSX.Element) | React.ElementType<any, keyof React.JSX.IntrinsicElements>;
|
|
10
10
|
//# sourceMappingURL=getBlockImageComponent.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Data, FormState } from 'payload';
|
|
2
|
+
export declare const getCachedFormStateIfDataMatches: ({ cachedFormState, cachedSchemaPath, currentSchemaPath, formData, }: {
|
|
3
|
+
cachedFormState: FormState;
|
|
4
|
+
cachedSchemaPath?: string;
|
|
5
|
+
currentSchemaPath?: string;
|
|
6
|
+
formData: Data;
|
|
7
|
+
}) => false | FormState;
|
|
8
|
+
export declare const reduceFormStateToBlockData: (formState: FormState, currentData?: Data) => Data;
|
|
9
|
+
//# sourceMappingURL=getCachedFormStateIfDataMatches.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCachedFormStateIfDataMatches.d.ts","sourceRoot":"","sources":["../../../../src/features/blocks/client/getCachedFormStateIfDataMatches.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAK9C,eAAO,MAAM,+BAA+B,wEAKzC;IACD,eAAe,EAAE,SAAS,CAAA;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,EAAE,IAAI,CAAA;CACf,KAAG,KAAK,GAAG,SAcX,CAAA;AAED,eAAO,MAAM,0BAA0B,cAAe,SAAS,gBAAgB,IAAI,KAAG,IA4BrF,CAAA"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { dequal } from 'dequal/lite';
|
|
2
|
+
import { reduceFieldsToValues } from 'payload/shared';
|
|
3
|
+
export const getCachedFormStateIfDataMatches = ({
|
|
4
|
+
cachedFormState,
|
|
5
|
+
cachedSchemaPath,
|
|
6
|
+
currentSchemaPath,
|
|
7
|
+
formData
|
|
8
|
+
}) => {
|
|
9
|
+
if (cachedSchemaPath !== currentSchemaPath) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
const cachedData = reduceFormStateToBlockData(cachedFormState);
|
|
13
|
+
const currentData = normalizeData({
|
|
14
|
+
data: formData,
|
|
15
|
+
rowFieldPaths: getRowFieldPaths(cachedFormState)
|
|
16
|
+
});
|
|
17
|
+
return dequal(withoutSystemBlockFields(cachedData), withoutSystemBlockFields(currentData)) ? cachedFormState : false;
|
|
18
|
+
};
|
|
19
|
+
export const reduceFormStateToBlockData = (formState, currentData) => {
|
|
20
|
+
const formStateWithoutRowCounts = Object.fromEntries(Object.entries(formState).map(([path, fieldState]) => {
|
|
21
|
+
if (!fieldState || !Array.isArray(fieldState.rows)) {
|
|
22
|
+
return [path, fieldState];
|
|
23
|
+
}
|
|
24
|
+
if (fieldState.value === undefined || fieldState.disableFormData !== false && fieldState.isModified !== true && fieldState.rows.length === 0 && getValueAtPath(currentData, path) === null) {
|
|
25
|
+
return [path, {
|
|
26
|
+
...fieldState,
|
|
27
|
+
value: null
|
|
28
|
+
}];
|
|
29
|
+
}
|
|
30
|
+
return [path, fieldState.value === null ? fieldState : {
|
|
31
|
+
...fieldState,
|
|
32
|
+
disableFormData: true
|
|
33
|
+
}];
|
|
34
|
+
}));
|
|
35
|
+
return normalizeData({
|
|
36
|
+
data: reduceFieldsToValues(formStateWithoutRowCounts, true),
|
|
37
|
+
rowFieldPaths: new Set()
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const getValueAtPath = (data, path) => path.split('.').reduce((value, pathSegment) => {
|
|
41
|
+
if (!value || typeof value !== 'object') {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
return value[pathSegment];
|
|
45
|
+
}, data);
|
|
46
|
+
const getRowFieldPaths = formState => new Set(Object.entries(formState).filter(([, fieldState]) => Array.isArray(fieldState?.rows) && fieldState.value !== null && fieldState.value !== undefined).map(([path]) => path));
|
|
47
|
+
const normalizeData = ({
|
|
48
|
+
data,
|
|
49
|
+
parentPath = '',
|
|
50
|
+
rowFieldPaths
|
|
51
|
+
}) => {
|
|
52
|
+
const normalizedData = {};
|
|
53
|
+
for (const [key, value] of Object.entries(data)) {
|
|
54
|
+
const path = parentPath ? `${parentPath}.${key}` : key;
|
|
55
|
+
const normalizedValue = normalizeValue({
|
|
56
|
+
parentPath: path,
|
|
57
|
+
rowFieldPaths,
|
|
58
|
+
value
|
|
59
|
+
});
|
|
60
|
+
if (normalizedValue !== undefined) {
|
|
61
|
+
normalizedData[key] = normalizedValue;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return normalizedData;
|
|
65
|
+
};
|
|
66
|
+
const normalizeValue = ({
|
|
67
|
+
parentPath,
|
|
68
|
+
rowFieldPaths,
|
|
69
|
+
value
|
|
70
|
+
}) => {
|
|
71
|
+
if (value === undefined || Array.isArray(value) && value.length === 0 && rowFieldPaths.has(parentPath)) {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
if (Array.isArray(value)) {
|
|
75
|
+
return value.map((item, index) => item && typeof item === 'object' && !Array.isArray(item) ? normalizeData({
|
|
76
|
+
data: item,
|
|
77
|
+
parentPath: `${parentPath}.${index}`,
|
|
78
|
+
rowFieldPaths
|
|
79
|
+
}) : item);
|
|
80
|
+
}
|
|
81
|
+
if (value && typeof value === 'object' && Object.getPrototypeOf(value) === Object.prototype) {
|
|
82
|
+
return normalizeData({
|
|
83
|
+
data: value,
|
|
84
|
+
parentPath,
|
|
85
|
+
rowFieldPaths
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return value;
|
|
89
|
+
};
|
|
90
|
+
const withoutSystemBlockFields = ({
|
|
91
|
+
blockName: _blockName,
|
|
92
|
+
blockType: _blockType,
|
|
93
|
+
...data
|
|
94
|
+
}) => data;
|
|
95
|
+
//# sourceMappingURL=getCachedFormStateIfDataMatches.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCachedFormStateIfDataMatches.js","names":["dequal","reduceFieldsToValues","getCachedFormStateIfDataMatches","cachedFormState","cachedSchemaPath","currentSchemaPath","formData","cachedData","reduceFormStateToBlockData","currentData","normalizeData","data","rowFieldPaths","getRowFieldPaths","withoutSystemBlockFields","formState","formStateWithoutRowCounts","Object","fromEntries","entries","map","path","fieldState","Array","isArray","rows","value","undefined","disableFormData","isModified","length","getValueAtPath","Set","split","reduce","pathSegment","filter","parentPath","normalizedData","key","normalizedValue","normalizeValue","has","item","index","getPrototypeOf","prototype","blockName","_blockName","blockType","_blockType"],"sources":["../../../../src/features/blocks/client/getCachedFormStateIfDataMatches.ts"],"sourcesContent":["import type { Data, FormState } from 'payload'\n\nimport { dequal } from 'dequal/lite'\nimport { reduceFieldsToValues } from 'payload/shared'\n\nexport const getCachedFormStateIfDataMatches = ({\n cachedFormState,\n cachedSchemaPath,\n currentSchemaPath,\n formData,\n}: {\n cachedFormState: FormState\n cachedSchemaPath?: string\n currentSchemaPath?: string\n formData: Data\n}): false | FormState => {\n if (cachedSchemaPath !== currentSchemaPath) {\n return false\n }\n\n const cachedData = reduceFormStateToBlockData(cachedFormState)\n const currentData = normalizeData({\n data: formData,\n rowFieldPaths: getRowFieldPaths(cachedFormState),\n })\n\n return dequal(withoutSystemBlockFields(cachedData), withoutSystemBlockFields(currentData))\n ? cachedFormState\n : false\n}\n\nexport const reduceFormStateToBlockData = (formState: FormState, currentData?: Data): Data => {\n const formStateWithoutRowCounts = Object.fromEntries(\n Object.entries(formState).map(([path, fieldState]) => {\n if (!fieldState || !Array.isArray(fieldState.rows)) {\n return [path, fieldState]\n }\n\n if (\n fieldState.value === undefined ||\n (fieldState.disableFormData !== false &&\n fieldState.isModified !== true &&\n fieldState.rows.length === 0 &&\n getValueAtPath(currentData, path) === null)\n ) {\n return [path, { ...fieldState, value: null }]\n }\n\n return [\n path,\n fieldState.value === null ? fieldState : { ...fieldState, disableFormData: true },\n ]\n }),\n ) as FormState\n\n return normalizeData({\n data: reduceFieldsToValues(formStateWithoutRowCounts, true),\n rowFieldPaths: new Set(),\n })\n}\n\nconst getValueAtPath = (data: Data | undefined, path: string): unknown =>\n path.split('.').reduce<unknown>((value, pathSegment) => {\n if (!value || typeof value !== 'object') {\n return undefined\n }\n\n return (value as Record<string, unknown>)[pathSegment]\n }, data)\n\nconst getRowFieldPaths = (formState: FormState): Set<string> =>\n new Set(\n Object.entries(formState)\n .filter(\n ([, fieldState]) =>\n Array.isArray(fieldState?.rows) &&\n fieldState.value !== null &&\n fieldState.value !== undefined,\n )\n .map(([path]) => path),\n )\n\nconst normalizeData = ({\n data,\n parentPath = '',\n rowFieldPaths,\n}: {\n data: Data\n parentPath?: string\n rowFieldPaths: Set<string>\n}): Data => {\n const normalizedData: Data = {}\n\n for (const [key, value] of Object.entries(data)) {\n const path = parentPath ? `${parentPath}.${key}` : key\n const normalizedValue = normalizeValue({ parentPath: path, rowFieldPaths, value })\n\n if (normalizedValue !== undefined) {\n normalizedData[key] = normalizedValue\n }\n }\n\n return normalizedData\n}\n\nconst normalizeValue = ({\n parentPath,\n rowFieldPaths,\n value,\n}: {\n parentPath: string\n rowFieldPaths: Set<string>\n value: unknown\n}): unknown => {\n if (\n value === undefined ||\n (Array.isArray(value) && value.length === 0 && rowFieldPaths.has(parentPath))\n ) {\n return undefined\n }\n\n if (Array.isArray(value)) {\n return value.map((item, index) =>\n item && typeof item === 'object' && !Array.isArray(item)\n ? normalizeData({\n data: item as Data,\n parentPath: `${parentPath}.${index}`,\n rowFieldPaths,\n })\n : item,\n )\n }\n\n if (value && typeof value === 'object' && Object.getPrototypeOf(value) === Object.prototype) {\n return normalizeData({ data: value as Data, parentPath, rowFieldPaths })\n }\n\n return value\n}\n\nconst withoutSystemBlockFields = ({\n blockName: _blockName,\n blockType: _blockType,\n ...data\n}: Data): Data => data\n"],"mappings":"AAEA,SAASA,MAAM,QAAQ;AACvB,SAASC,oBAAoB,QAAQ;AAErC,OAAO,MAAMC,+BAAA,GAAkCA,CAAC;EAC9CC,eAAe;EACfC,gBAAgB;EAChBC,iBAAiB;EACjBC;AAAQ,CAMT;EACC,IAAIF,gBAAA,KAAqBC,iBAAA,EAAmB;IAC1C,OAAO;EACT;EAEA,MAAME,UAAA,GAAaC,0BAAA,CAA2BL,eAAA;EAC9C,MAAMM,WAAA,GAAcC,aAAA,CAAc;IAChCC,IAAA,EAAML,QAAA;IACNM,aAAA,EAAeC,gBAAA,CAAiBV,eAAA;EAClC;EAEA,OAAOH,MAAA,CAAOc,wBAAA,CAAyBP,UAAA,GAAaO,wBAAA,CAAyBL,WAAA,KACzEN,eAAA,GACA;AACN;AAEA,OAAO,MAAMK,0BAAA,GAA6BA,CAACO,SAAA,EAAsBN,WAAA;EAC/D,MAAMO,yBAAA,GAA4BC,MAAA,CAAOC,WAAW,CAClDD,MAAA,CAAOE,OAAO,CAACJ,SAAA,EAAWK,GAAG,CAAC,CAAC,CAACC,IAAA,EAAMC,UAAA,CAAW;IAC/C,IAAI,CAACA,UAAA,IAAc,CAACC,KAAA,CAAMC,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AOpC,aAAA,CAAc;MAAEC,IAAA,EAAMe,KAAA;MAAeW,UAAA;MAAYzB;IAAc;EACxE;EAEA,OAAOc,KAAA;AACT;AAEA,MAAMZ,wBAAA,GAA2BA,CAAC;EAChCiC,SAAA,EAAWC,UAAU;EACrBC,SAAA,EAAWC,UAAU;EACrB,GAAGvC;AAAA,CACE,KAAWA,IAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdownTransformer.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/markdown/markdownTransformer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAC3B,oBAAoB,EACpB,WAAW,EACZ,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C,OAAO,EAGL,KAAK,KAAK,EACV,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAE5B,MAAM,SAAS,CAAA;AAqBhB,eAAO,MAAM,4BAA4B,
|
|
1
|
+
{"version":3,"file":"markdownTransformer.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/markdown/markdownTransformer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAC3B,oBAAoB,EACpB,WAAW,EACZ,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C,OAAO,EAGL,KAAK,KAAK,EACV,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAE5B,MAAM,SAAS,CAAA;AAqBhB,eAAO,MAAM,4BAA4B,8BAGtC;IACD,MAAM,EAAE,WAAW,EAAE,CAAA;IACrB,YAAY,EAAE,WAAW,EAAE,CAAA;CAC5B,KAAG,CAAC,CAAC,KAAK,EAAE;IACX,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,sBAAsB,CAAC,CAAA;IAC5D,eAAe,EAAE,WAAW,EAAE,CAAA;CAC/B,KAAK,2BAA2B,GAAG,oBAAoB,CAAC,EA8BxD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlocksNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/nodes/BlocksNode.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EACjB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAA;AAEvC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAA;AAC5E,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAExF,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAGlE,MAAM,MAAM,qBAAqB,GAAG,CAClC,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,YAAY,EACpB,WAAW,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAAC,EAClD,WAAW,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAAC,KAC/C,GAAG,CAAC,OAAO,CAAA;AAEhB,qBAAa,SAAU,SAAQ,eAAe;
|
|
1
|
+
{"version":3,"file":"BlocksNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/nodes/BlocksNode.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EACjB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAA;AAEvC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAA;AAC5E,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAExF,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAGlE,MAAM,MAAM,qBAAqB,GAAG,CAClC,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,YAAY,EACpB,WAAW,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAAC,EAClD,WAAW,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAAC,KAC/C,GAAG,CAAC,OAAO,CAAA;AAEhB,qBAAa,SAAU,SAAQ,eAAe;IAC5C,OAAgB,KAAK,CAAC,IAAI,EAAE,eAAe,GAAG,eAAe,CAE5D;IAED,OAAgB,OAAO,IAAI,MAAM,CAEhC;IAED,OAAgB,UAAU,CAAC,cAAc,EAAE,mBAAmB,GAAG,SAAS,CAIzE;IAEQ,QAAQ,CACf,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,CAAC,EAAE,UAAU,CAAC,qBAAqB,CAAC,GAChF,UAAU,CAAC,qBAAqB,CAAC,CAWnC;IAEQ,UAAU,IAAI,mBAAmB,CAEzC;CACF;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,qBAAqB,GAAG,SAAS,CASzE;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,IAAI,SAAS,CAEhG"}
|
|
@@ -14,16 +14,6 @@ export class BlockNode extends ServerBlockNode {
|
|
|
14
14
|
return super.getType();
|
|
15
15
|
}
|
|
16
16
|
static importJSON(serializedNode) {
|
|
17
|
-
if (serializedNode.version === 1) {
|
|
18
|
-
// Convert (version 1 had the fields wrapped in another, unnecessary data property)
|
|
19
|
-
serializedNode = {
|
|
20
|
-
...serializedNode,
|
|
21
|
-
fields: {
|
|
22
|
-
...serializedNode.fields.data
|
|
23
|
-
},
|
|
24
|
-
version: 2
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
17
|
const node = $createBlockNode(serializedNode.fields);
|
|
28
18
|
node.setFormat(serializedNode.format);
|
|
29
19
|
return node;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlocksNode.js","names":["ObjectID","$applyNodeReplacement","React","ServerBlockNode","BlockComponent","BlockNode","clone","node","getType","importJSON","serializedNode","
|
|
1
|
+
{"version":3,"file":"BlocksNode.js","names":["ObjectID","$applyNodeReplacement","React","ServerBlockNode","BlockComponent","BlockNode","clone","node","getType","importJSON","serializedNode","$createBlockNode","fields","setFormat","format","decorate","_editor","config","CustomBlock","CustomLabel","_jsx","cacheBuster","getCacheBuster","className","theme","block","formData","getFields","nodeKey","getKey","exportJSON","id","default","toHexString","$isBlockNode"],"sources":["../../../../../src/features/blocks/client/nodes/BlocksNode.tsx"],"sourcesContent":["'use client'\nimport ObjectID from 'bson-objectid'\nimport {\n $applyNodeReplacement,\n type EditorConfig,\n type LexicalEditor,\n type LexicalNode,\n} from 'lexical'\nimport React, { type JSX } from 'react'\n\nimport type { ViewMapBlockComponentProps } from '../../../../types/index.js'\nimport type { BlockFieldsOptionalID, SerializedBlockNode } from '../../server/schema.js'\n\nimport { ServerBlockNode } from '../../server/nodes/BlocksNode.js'\nimport { BlockComponent } from '../component/index.js'\n\nexport type BlockDecorateFunction = (\n editor: LexicalEditor,\n config: EditorConfig,\n CustomBlock?: React.FC<ViewMapBlockComponentProps>,\n CustomLabel?: React.FC<ViewMapBlockComponentProps>,\n) => JSX.Element\n\nexport class BlockNode extends ServerBlockNode {\n static override clone(node: ServerBlockNode): ServerBlockNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n static override importJSON(serializedNode: SerializedBlockNode): BlockNode {\n const node = $createBlockNode(serializedNode.fields)\n node.setFormat(serializedNode.format)\n return node\n }\n\n override decorate(\n ...[_editor, config, CustomBlock, CustomLabel]: Parameters<BlockDecorateFunction>\n ): ReturnType<BlockDecorateFunction> {\n return (\n <BlockComponent\n cacheBuster={this.getCacheBuster()}\n className={config.theme.block ?? 'LexicalEditorTheme__block'}\n CustomBlock={CustomBlock}\n CustomLabel={CustomLabel}\n formData={this.getFields()}\n nodeKey={this.getKey()}\n />\n )\n }\n\n override exportJSON(): SerializedBlockNode {\n return super.exportJSON()\n }\n}\n\nexport function $createBlockNode(fields: BlockFieldsOptionalID): BlockNode {\n return $applyNodeReplacement(\n new BlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n }),\n )\n}\n\nexport function $isBlockNode(node: BlockNode | LexicalNode | null | undefined): node is BlockNode {\n return node instanceof BlockNode\n}\n"],"mappings":"AAAA;;;AACA,OAAOA,QAAA,MAAc;AACrB,SACEC,qBAAqB,QAIhB;AACP,OAAOC,KAAA,MAAyB;AAKhC,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAS/B,OAAO,MAAMC,SAAA,SAAkBF,eAAA;EAC7B,OAAgBG,MAAMC,IAAqB,EAAmB;IAC5D,OAAO,KAAK,CAACD,KAAA,CAAMC,IAAA;EACrB;EAEA,OAAgBC,QAAA,EAAkB;IAChC,OAAO,KAAK,CAACA,OAAA;EACf;EAEA,OAAgBC,WAAWC,cAAmC,EAAa;IACzE,MAAMH,IAAA,GAAOI,gBAAA,CAAiBD,cAAA,CAAeE,MAAM;IACnDL,IAAA,CAAKM,SAAS,CAACH,cAAA,CAAeI,MAAM;IACpC,OAAOP,IAAA;EACT;EAESQ,SACP,GAAG,CAACC,OAAA,EAASC,MAAA,EAAQC,WAAA,EAAaC,WAAA,CAAY,EACX;IACnC,oBACEC,IAAA,CAAChB,cAAA;MACCiB,WAAA,EAAa,IAAI,CAACC,cAAc;MAChCC,SAAA,EAAWN,MAAA,CAAOO,KAAK,CAACC,KAAK,IAAI;MACjCP,WAAA,EAAaA,WAAA;MACbC,WAAA,EAAaA,WAAA;MACbO,QAAA,EAAU,IAAI,CAACC,SAAS;MACxBC,OAAA,EAAS,IAAI,CAACC,MAAM;;EAG1B;EAESC,WAAA,EAAkC;IACzC,OAAO,KAAK,CAACA,UAAA;EACf;AACF;AAEA,OAAO,SAASnB,iBAAiBC,MAA6B;EAC5D,OAAOX,qBAAA,CACL,IAAII,SAAA,CAAU;IACZO,MAAA,EAAQ;MACN,GAAGA,MAAM;MACTmB,EAAA,EAAInB,MAAA,EAAQmB,EAAA,IAAM,IAAI/B,QAAA,CAASgC,OAAO,GAAGC,WAAW;IACtD;EACF;AAEJ;AAEA,OAAO,SAASC,aAAa3B,IAAgD;EAC3E,OAAOA,IAAA,YAAgBF,SAAA;AACzB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlineBlocksNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/nodes/InlineBlocksNode.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EACjB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAA;AAEvC,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,4BAA4B,CAAA;AAClF,OAAO,KAAK,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAA;AAE1F,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAA;AAQ9E,MAAM,MAAM,2BAA2B,GAAG,CACxC,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,YAAY,EACpB,WAAW,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,gCAAgC,CAAC,EACxD,WAAW,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,gCAAgC,CAAC,KACrD,GAAG,CAAC,OAAO,CAAA;AAEhB,qBAAa,eAAgB,SAAQ,qBAAqB;
|
|
1
|
+
{"version":3,"file":"InlineBlocksNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/nodes/InlineBlocksNode.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,aAAa,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/blocks/server/graphQLPopulationPromise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAIjF,eAAO,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"graphQLPopulationPromise.d.ts","sourceRoot":"","sources":["../../../../src/features/blocks/server/graphQLPopulationPromise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAIjF,eAAO,MAAM,yBAAyB,WAC5B,KAAK,EAAE,KACd,iBAAiB,CAAC,mBAAmB,GAAG,yBAAyB,CAiDnE,CAAA"}
|
|
@@ -10,14 +10,14 @@ import { ServerInlineBlockNode } from './nodes/InlineBlocksNode.js';
|
|
|
10
10
|
import { createBlockNodeJSONSchema, createInlineBlockNodeJSONSchema } from './schema.js';
|
|
11
11
|
import { blockValidationHOC } from './validate.js';
|
|
12
12
|
export const BlocksFeature = createServerFeature({
|
|
13
|
-
feature:
|
|
13
|
+
feature: ({
|
|
14
14
|
config: _config,
|
|
15
15
|
isRoot,
|
|
16
16
|
parentIsLocalized,
|
|
17
17
|
props: _props
|
|
18
18
|
}) => {
|
|
19
19
|
const validRelationships = _config.collections.map(c => c.slug) || [];
|
|
20
|
-
const sanitized =
|
|
20
|
+
const sanitized = sanitizeFields({
|
|
21
21
|
config: _config,
|
|
22
22
|
fields: [{
|
|
23
23
|
name: 'lexical_blocks',
|