@payloadcms/richtext-lexical 4.0.0-internal.9496957 → 4.0.0-internal.94ef095
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/exports/client/Field-334JNLRF.js +2 -0
- package/dist/exports/client/Field-334JNLRF.js.map +7 -0
- package/dist/exports/client/{RelationshipComponent-YCPAKOL7.js → RelationshipComponent-TVK6I4W4.js} +2 -2
- package/dist/exports/client/chunk-3V7KW5XF.js +2 -0
- package/dist/exports/client/chunk-3V7KW5XF.js.map +7 -0
- package/dist/exports/client/chunk-A7DZCL6D.js +2 -0
- package/dist/exports/client/chunk-A7DZCL6D.js.map +7 -0
- package/dist/exports/client/{chunk-WSAPGI3Z.js → chunk-EA5BHQ2T.js} +1 -1
- package/dist/exports/client/{chunk-WSAPGI3Z.js.map → chunk-EA5BHQ2T.js.map} +1 -1
- package/dist/exports/client/chunk-FAJJXXCW.js +2 -0
- package/dist/exports/client/chunk-FAJJXXCW.js.map +7 -0
- package/dist/exports/client/{chunk-5VIL27GI.js → chunk-IYBYNEKX.js} +1 -1
- package/dist/exports/client/{chunk-5VIL27GI.js.map → chunk-IYBYNEKX.js.map} +1 -1
- package/dist/exports/client/{component-D5QLYS7W.js → component-FCCSBBZG.js} +2 -2
- package/dist/exports/client/componentInline-7FQV2X7Z.js +2 -0
- package/dist/exports/client/index.js +28 -28
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/align/client/index.js.map +1 -1
- package/dist/features/blocks/client/component/BlockContent.js.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/components/BlockCollapsible.js.map +1 -1
- package/dist/features/blocks/client/component/components/BlockEditButton.js.map +1 -1
- package/dist/features/blocks/client/component/components/BlockRemoveButton.js.map +1 -1
- 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 +209 -164
- 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.js.map +1 -1
- package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js.map +1 -1
- package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js.map +1 -1
- package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js.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 +37 -76
- package/dist/features/blocks/client/componentInline/index.js.map +1 -1
- package/dist/features/blocks/client/getCachedFormStateIfDataMatches.d.ts +8 -0
- package/dist/features/blocks/client/getCachedFormStateIfDataMatches.d.ts.map +1 -0
- package/dist/features/blocks/client/getCachedFormStateIfDataMatches.js +72 -0
- package/dist/features/blocks/client/getCachedFormStateIfDataMatches.js.map +1 -0
- 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/plugin/index.js.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Block.js +121 -78
- package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Code.js +142 -87
- package/dist/features/blocks/premade/CodeBlock/Component/Code.js.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.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.js +1 -1
- package/dist/features/blocks/server/validate.js.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/table.d.ts.map +1 -1
- package/dist/features/converters/lexicalToHtml/async/converters/table.js +6 -4
- package/dist/features/converters/lexicalToHtml/async/converters/table.js.map +1 -1
- package/dist/features/converters/lexicalToHtml/async/converters/upload.d.ts.map +1 -1
- package/dist/features/converters/lexicalToHtml/async/converters/upload.js +5 -4
- package/dist/features/converters/lexicalToHtml/async/converters/upload.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/table.d.ts.map +1 -1
- package/dist/features/converters/lexicalToHtml/sync/converters/table.js +6 -4
- package/dist/features/converters/lexicalToHtml/sync/converters/table.js.map +1 -1
- package/dist/features/converters/lexicalToHtml/sync/converters/upload.d.ts.map +1 -1
- package/dist/features/converters/lexicalToHtml/sync/converters/upload.js +5 -4
- package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
- package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +1 -1
- package/dist/features/converters/lexicalToHtml/sync/types.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/table.d.ts.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/table.js +3 -2
- package/dist/features/converters/lexicalToJSX/converter/converters/table.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/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/jsxConverter/client/plugin/index.js.map +1 -1
- package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
- package/dist/features/debug/treeView/client/plugin/index.js.map +1 -1
- package/dist/features/heading/client/index.js.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/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 +11 -1
- package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
- package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js +17 -0
- package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
- package/dist/features/horizontalRule/client/plugin/index.js.map +1 -1
- package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js +2 -2
- 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/index.d.ts.map +1 -1
- package/dist/features/indent/client/index.js +0 -2
- package/dist/features/indent/client/index.js.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.js.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 +20 -9
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/index.css +0 -1
- package/dist/features/link/client/plugins/link/index.js.map +1 -1
- package/dist/features/link/markdownTransformer.js +2 -2
- package/dist/features/link/markdownTransformer.js.map +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.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.js.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/schema.d.ts.map +1 -1
- package/dist/features/lists/shared/schema.js.map +1 -1
- 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.js.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/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/table/client/plugins/TableActionMenuPlugin/index.css +1 -2
- package/dist/features/table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -1
- package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js +17 -44
- package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
- package/dist/features/table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -1
- package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js +48 -25
- package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
- package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
- package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.css +0 -3
- package/dist/features/table/client/plugins/TablePlugin/index.js +54 -18
- package/dist/features/table/client/plugins/TablePlugin/index.js.map +1 -1
- package/dist/features/table/client/utils/useDebounce.js.map +1 -1
- package/dist/features/table/server/index.d.ts.map +1 -1
- package/dist/features/table/server/index.js +3 -1
- package/dist/features/table/server/index.js.map +1 -1
- package/dist/features/table/server/validate.d.ts +4 -0
- package/dist/features/table/server/validate.d.ts.map +1 -0
- package/dist/features/table/server/validate.js +15 -0
- package/dist/features/table/server/validate.js.map +1 -0
- package/dist/features/textState/defaultColors.js +1 -1
- package/dist/features/textState/defaultColors.js.map +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js.map +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.js +141 -70
- package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/inline/client/Toolbar/index.d.ts.map +1 -1
- package/dist/features/toolbars/inline/client/Toolbar/index.js +84 -37
- 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 +27 -2
- 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 +199 -81
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.css +16 -12
- package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js +22 -6
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js.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 +109 -0
- package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.js.map +1 -0
- package/dist/features/typesServer.d.ts +16 -11
- 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/drawer/index.js.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 +18 -14
- 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.d.ts.map +1 -1
- package/dist/field/Diff/converters/upload/index.js +8 -7
- 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 +4 -2
- package/dist/field/Diff/index.js.map +1 -1
- package/dist/field/Field.d.ts.map +1 -1
- package/dist/field/Field.js +8 -1
- 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 +13 -4
- package/dist/field/ViewSelector.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/field/index.css +0 -1
- package/dist/field/index.js.map +1 -1
- 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 +44 -0
- package/dist/i18n.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -1
- package/dist/index.js.map +1 -1
- package/dist/lexical/LexicalEditor.css +21 -10
- package/dist/lexical/LexicalEditor.d.ts.map +1 -1
- package/dist/lexical/LexicalEditor.js +61 -64
- package/dist/lexical/LexicalEditor.js.map +1 -1
- package/dist/lexical/plugins/ClipboardPlugin/index.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 +2 -1
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
- package/dist/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
- package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +235 -88
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/index.css +0 -1
- package/dist/lexical/plugins/SlashMenu/useMenuTriggerMatch.js.map +1 -1
- package/dist/lexical/plugins/TextPlugin/index.js.map +1 -1
- 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/index.css +17 -0
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +139 -37
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/moveBlock.d.ts +7 -0
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/moveBlock.d.ts.map +1 -0
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/moveBlock.js +15 -0
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/moveBlock.js.map +1 -0
- 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 +62 -0
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js.map +1 -0
- 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.d.ts +2 -1
- package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
- package/dist/lexical/ui/ContentEditable.js +32 -11
- 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/nodeFormat.d.ts.map +1 -1
- package/dist/lexical/utils/nodeFormat.js +0 -2
- package/dist/lexical/utils/nodeFormat.js.map +1 -1
- package/dist/lexical/utils/url.d.ts.map +1 -1
- package/dist/lexical/utils/url.js +1 -1
- package/dist/lexical/utils/url.js.map +1 -1
- package/dist/populateGraphQL/populate.d.ts.map +1 -1
- package/dist/populateGraphQL/populate.js +4 -1
- package/dist/populateGraphQL/populate.js.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 +3 -6
- 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 +5 -0
- package/dist/types/nodeTypes.d.ts.map +1 -1
- package/dist/types/nodeTypes.js.map +1 -1
- package/dist/utilities/buildEditorState.d.ts.map +1 -1
- package/dist/utilities/buildEditorState.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/fieldsDrawer/Drawer.js +36 -36
- package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
- package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
- package/dist/utilities/fieldsDrawer/DrawerContent.js +127 -107
- package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
- package/dist/utilities/fieldsDrawer/useDrawerSubmit.js.map +1 -1
- package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js.map +1 -1
- package/dist/utilities/fieldsDrawer/useLexicalDrawer.js.map +1 -1
- package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js.map +1 -1
- package/dist/utilities/generateImportMap.d.ts +2 -2
- package/dist/utilities/generateImportMap.d.ts.map +1 -1
- package/dist/utilities/generateImportMap.js.map +1 -1
- package/dist/utilities/initLexicalFeatures.d.ts.map +1 -1
- package/dist/utilities/initLexicalFeatures.js +38 -4
- package/dist/utilities/initLexicalFeatures.js.map +1 -1
- package/dist/utilities/upgradeLexicalData/index.js +6 -3
- package/dist/utilities/upgradeLexicalData/index.js.map +1 -1
- package/dist/utilities/useLexicalFeature.js +15 -6
- package/dist/utilities/useLexicalFeature.js.map +1 -1
- package/dist/utilities/useRunDeprioritized.js.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 +51 -54
- package/dist/dependencyChecker.spec.js +0 -16
- package/dist/dependencyChecker.spec.js.map +0 -1
- package/dist/exports/client/Field-F22V5L4V.js +0 -2
- package/dist/exports/client/Field-F22V5L4V.js.map +0 -7
- package/dist/exports/client/bundled.css +0 -1
- package/dist/exports/client/chunk-43E5QYAA.js +0 -2
- package/dist/exports/client/chunk-43E5QYAA.js.map +0 -7
- package/dist/exports/client/chunk-ESITTE3C.js +0 -2
- package/dist/exports/client/chunk-ESITTE3C.js.map +0 -7
- package/dist/exports/client/chunk-LN6VX25I.js +0 -2
- package/dist/exports/client/chunk-LN6VX25I.js.map +0 -7
- package/dist/exports/client/componentInline-H24N7GUG.js +0 -2
- 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/lexicalToHtml/sync/alignment.spec.js +0 -92
- package/dist/features/converters/lexicalToHtml/sync/alignment.spec.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/link/markdownTransformer.spec.js +0 -195
- package/dist/features/link/markdownTransformer.spec.js.map +0 -1
- package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.spec.js +0 -65
- package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.spec.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/{RelationshipComponent-YCPAKOL7.js.map → RelationshipComponent-TVK6I4W4.js.map} +0 -0
- /package/dist/exports/client/{component-D5QLYS7W.js.map → component-FCCSBBZG.js.map} +0 -0
- /package/dist/exports/client/{componentInline-H24N7GUG.js.map → componentInline-7FQV2X7Z.js.map} +0 -0
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
4
5
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
5
6
|
import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
|
|
6
7
|
import { getTranslation } from '@payloadcms/translations';
|
|
7
|
-
import { Button, Collapsible, Drawer, EditDepthProvider, ErrorPill, Form, formatDrawerSlug, MoreIcon, Pill, Popup, PopupList, RenderFields, SectionTitle, useConfig, useDocumentForm, useDocumentInfo, useEditDepth, useFormSubmitted, useServerFunctions, useTranslation, XIcon } from '@payloadcms/ui';
|
|
8
|
+
import { Button, Collapsible, Drawer, EditDepthProvider, ErrorPill, Form, formatDrawerSlug, MoreIcon, Pill, Popup, PopupList, RenderFields, SectionTitle, useConfig, useDocumentForm, useDocumentInfo, useEditDepth, useFormSubmitted, useOperation, useServerFunctions, useTranslation, XIcon } from '@payloadcms/ui';
|
|
8
9
|
import { abortAndIgnore } from '@payloadcms/ui/shared';
|
|
9
10
|
import { $getNodeByKey, $getRoot, SKIP_DOM_SELECTION_TAG } from 'lexical';
|
|
10
|
-
import { deepCopyObjectSimpleWithoutReactComponents,
|
|
11
|
+
import { deepCopyObjectSimpleWithoutReactComponents, getDataFromFormState } from 'payload/shared';
|
|
11
12
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
12
13
|
import { v4 as uuid } from 'uuid';
|
|
13
14
|
import './index.css';
|
|
@@ -15,9 +16,10 @@ import '../../../../utilities/fieldsDrawer/index.css';
|
|
|
15
16
|
import { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js';
|
|
16
17
|
import { RegisterFormSubmit, useDrawerSubmit } from '../../../../utilities/fieldsDrawer/useDrawerSubmit.js';
|
|
17
18
|
import { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js';
|
|
19
|
+
import { getCachedFormStateIfDataMatches } from '../getCachedFormStateIfDataMatches.js';
|
|
18
20
|
import { $isBlockNode } from '../nodes/BlocksNode.js';
|
|
19
21
|
import { BlockContent, useBlockComponentContext } from './BlockContent.js';
|
|
20
|
-
import {
|
|
22
|
+
import { BlockReordering } from './BlockReordering/index.js';
|
|
21
23
|
export const BlockComponent = props => {
|
|
22
24
|
const {
|
|
23
25
|
cacheBuster,
|
|
@@ -45,7 +47,6 @@ export const BlockComponent = props => {
|
|
|
45
47
|
const {
|
|
46
48
|
fields: parentDocumentFields
|
|
47
49
|
} = useDocumentForm();
|
|
48
|
-
const onChangeAbortControllerRef = useRef(new AbortController());
|
|
49
50
|
const editDepth = useEditDepth();
|
|
50
51
|
const [errorCount, setErrorCount] = React.useState(0);
|
|
51
52
|
const {
|
|
@@ -67,32 +68,43 @@ export const BlockComponent = props => {
|
|
|
67
68
|
} = useDocumentInfo();
|
|
68
69
|
const [editor] = useLexicalComposerContext();
|
|
69
70
|
const isEditable = useLexicalEditable();
|
|
71
|
+
const operation = useOperation();
|
|
70
72
|
const blockType = formData.blockType;
|
|
73
|
+
const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockType}`;
|
|
74
|
+
const clientSchemaMap = featureClientSchemaMap['blocks'];
|
|
75
|
+
const blocksField = clientSchemaMap?.[componentMapRenderedBlockPath]?.[0];
|
|
76
|
+
const blockOrSlug = blocksField?.blocks?.[0];
|
|
77
|
+
const clientBlock = typeof blockOrSlug === 'string' ? config.blocksMap[blockOrSlug] : blockOrSlug;
|
|
71
78
|
const {
|
|
72
79
|
getFormState
|
|
73
80
|
} = useServerFunctions();
|
|
74
81
|
const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockType}.fields`;
|
|
75
82
|
const [initialState, setInitialState] = React.useState(() => {
|
|
76
83
|
// Initial form state that was calculated server-side. May have stale values
|
|
77
|
-
const
|
|
84
|
+
const cachedState = initialLexicalFormState?.[formData.id];
|
|
85
|
+
const cachedFormState = cachedState?.formState;
|
|
78
86
|
if (!cachedFormState) {
|
|
79
87
|
return false;
|
|
80
88
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
89
|
+
const matchingCachedState = getCachedFormStateIfDataMatches({
|
|
90
|
+
cachedFormState,
|
|
91
|
+
cachedSchemaPath: cachedState.schemaPath,
|
|
92
|
+
currentSchemaPath: schemaFieldsPath,
|
|
93
|
+
formData
|
|
94
|
+
});
|
|
95
|
+
if (!matchingCachedState) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
88
98
|
// Manually add blockName, as it's not part of cachedFormState
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
99
|
+
return {
|
|
100
|
+
...matchingCachedState,
|
|
101
|
+
blockName: {
|
|
102
|
+
initialValue: formData.blockName,
|
|
103
|
+
passesCondition: true,
|
|
104
|
+
valid: true,
|
|
105
|
+
value: formData.blockName
|
|
106
|
+
}
|
|
94
107
|
};
|
|
95
|
-
return mergedState;
|
|
96
108
|
});
|
|
97
109
|
const hasMounted = useRef(false);
|
|
98
110
|
const prevCacheBuster = useRef(cacheBuster);
|
|
@@ -134,7 +146,7 @@ export const BlockComponent = props => {
|
|
|
134
146
|
isEditor: true,
|
|
135
147
|
isJSXConverter: false,
|
|
136
148
|
nodeKey: nodeKey,
|
|
137
|
-
// eslint-disable-next-line react-
|
|
149
|
+
// eslint-disable-next-line react-hooks/hooks -- intentionally passed as a prop for custom block components to call
|
|
138
150
|
useBlockComponentContext: useBlockComponentContext
|
|
139
151
|
});
|
|
140
152
|
}
|
|
@@ -148,7 +160,7 @@ export const BlockComponent = props => {
|
|
|
148
160
|
isEditor: true,
|
|
149
161
|
isJSXConverter: false,
|
|
150
162
|
nodeKey: nodeKey,
|
|
151
|
-
// eslint-disable-next-line react-
|
|
163
|
+
// eslint-disable-next-line react-hooks/hooks -- intentionally passed as a prop for custom block components to call
|
|
152
164
|
useBlockComponentContext: useBlockComponentContext
|
|
153
165
|
});
|
|
154
166
|
}
|
|
@@ -173,12 +185,10 @@ export const BlockComponent = props => {
|
|
|
173
185
|
fields: true
|
|
174
186
|
},
|
|
175
187
|
docPreferences: await getDocPreferences(),
|
|
176
|
-
documentFormState:
|
|
177
|
-
excludeFiles: true
|
|
178
|
-
}),
|
|
188
|
+
documentFormState: parentDocumentFields,
|
|
179
189
|
globalSlug,
|
|
180
190
|
initialBlockData: formData,
|
|
181
|
-
operation
|
|
191
|
+
operation,
|
|
182
192
|
readOnly: !isEditable,
|
|
183
193
|
renderAllFields: true,
|
|
184
194
|
schemaPath: schemaFieldsPath,
|
|
@@ -191,7 +201,7 @@ export const BlockComponent = props => {
|
|
|
191
201
|
valid: true,
|
|
192
202
|
value: formData.blockName
|
|
193
203
|
};
|
|
194
|
-
const newFormStateData =
|
|
204
|
+
const newFormStateData = getDataFromFormState(deepCopyObjectSimpleWithoutReactComponents(state, {
|
|
195
205
|
excludeFiles: true
|
|
196
206
|
}), true);
|
|
197
207
|
// Things like default values may come back from the server => update the node with the new data
|
|
@@ -217,61 +227,24 @@ export const BlockComponent = props => {
|
|
|
217
227
|
}
|
|
218
228
|
}
|
|
219
229
|
};
|
|
220
|
-
if (formData && !initialState) {
|
|
230
|
+
if (clientBlock && formData && !initialState) {
|
|
221
231
|
void awaitInitialState();
|
|
222
232
|
}
|
|
223
233
|
return () => {
|
|
224
234
|
abortAndIgnore(abortController);
|
|
225
235
|
};
|
|
226
|
-
}, [getFormState, schemaFieldsPath, isEditable, id, CustomLabelFromProps, CustomBlockFromProps, formData, editor, nodeKey, initialState, collectionSlug, globalSlug, getDocPreferences, parentDocumentFields, blockType]);
|
|
236
|
+
}, [getFormState, schemaFieldsPath, isEditable, id, CustomLabelFromProps, CustomBlockFromProps, formData, editor, nodeKey, initialState, collectionSlug, globalSlug, getDocPreferences, operation, parentDocumentFields, blockType, clientBlock]);
|
|
227
237
|
const [isCollapsed, setIsCollapsed] = React.useState(initialLexicalFormState?.[formData.id]?.collapsed ?? false);
|
|
228
|
-
const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockType}`;
|
|
229
|
-
const clientSchemaMap = featureClientSchemaMap['blocks'];
|
|
230
|
-
const blocksField = clientSchemaMap?.[componentMapRenderedBlockPath]?.[0];
|
|
231
|
-
const blockOrSlug = blocksField?.blocks?.[0];
|
|
232
|
-
const clientBlock = typeof blockOrSlug === 'string' ? config.blocksMap[blockOrSlug] : blockOrSlug;
|
|
233
238
|
const {
|
|
234
239
|
i18n,
|
|
235
240
|
t
|
|
236
241
|
} = useTranslation();
|
|
237
|
-
const
|
|
238
|
-
formState: prevFormState,
|
|
239
|
-
submit
|
|
240
|
-
}) => {
|
|
241
|
-
abortAndIgnore(onChangeAbortControllerRef.current);
|
|
242
|
-
const controller = new AbortController();
|
|
243
|
-
onChangeAbortControllerRef.current = controller;
|
|
244
|
-
const {
|
|
245
|
-
state: newFormState
|
|
246
|
-
} = await getFormState({
|
|
247
|
-
id,
|
|
248
|
-
collectionSlug,
|
|
249
|
-
docPermissions: {
|
|
250
|
-
fields: true
|
|
251
|
-
},
|
|
252
|
-
docPreferences: await getDocPreferences(),
|
|
253
|
-
documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {
|
|
254
|
-
excludeFiles: true
|
|
255
|
-
}),
|
|
256
|
-
formState: prevFormState,
|
|
257
|
-
globalSlug,
|
|
258
|
-
initialBlockFormState: prevFormState,
|
|
259
|
-
operation: 'update',
|
|
260
|
-
readOnly: !isEditable,
|
|
261
|
-
renderAllFields: submit ? true : false,
|
|
262
|
-
schemaPath: schemaFieldsPath,
|
|
263
|
-
signal: controller.signal
|
|
264
|
-
});
|
|
265
|
-
if (!newFormState) {
|
|
266
|
-
return prevFormState;
|
|
267
|
-
}
|
|
242
|
+
const applyServerState = useCallback((newFormState, prevFormState) => {
|
|
268
243
|
if (prevFormState.blockName) {
|
|
269
244
|
newFormState.blockName = prevFormState.blockName;
|
|
270
245
|
}
|
|
271
|
-
const newFormStateData_0 =
|
|
272
|
-
|
|
273
|
-
excludeFiles: true
|
|
274
|
-
})
|
|
246
|
+
const newFormStateData_0 = getDataFromFormState(deepCopyObjectSimpleWithoutReactComponents(newFormState, {
|
|
247
|
+
excludeFiles: true
|
|
275
248
|
}), true);
|
|
276
249
|
setTimeout(() => {
|
|
277
250
|
editor.update(() => {
|
|
@@ -288,28 +261,22 @@ export const BlockComponent = props => {
|
|
|
288
261
|
tag: SKIP_DOM_SELECTION_TAG
|
|
289
262
|
});
|
|
290
263
|
}, 0);
|
|
291
|
-
|
|
264
|
+
}, [blockType, editor, nodeKey]);
|
|
265
|
+
const onChange = useCallback(({
|
|
266
|
+
formState,
|
|
267
|
+
submitted: submitted_0
|
|
268
|
+
}) => {
|
|
269
|
+
applyServerState(formState, formState);
|
|
270
|
+
if (submitted_0) {
|
|
292
271
|
if (!CustomLabelFromProps) {
|
|
293
|
-
setCustomLabel(
|
|
272
|
+
setCustomLabel(formState._components?.customComponents?.BlockLabel ?? undefined);
|
|
294
273
|
}
|
|
295
274
|
if (!CustomBlockFromProps) {
|
|
296
|
-
setCustomBlock(
|
|
297
|
-
}
|
|
298
|
-
let rowErrorCount = 0;
|
|
299
|
-
for (const formField of Object.values(newFormState)) {
|
|
300
|
-
if (formField?.valid === false) {
|
|
301
|
-
rowErrorCount++;
|
|
302
|
-
}
|
|
275
|
+
setCustomBlock(formState._components?.customComponents?.Block ?? undefined);
|
|
303
276
|
}
|
|
304
|
-
setErrorCount(
|
|
277
|
+
setErrorCount(Object.values(formState).filter(field => field.valid === false).length);
|
|
305
278
|
}
|
|
306
|
-
|
|
307
|
-
}, [getFormState, id, collectionSlug, getDocPreferences, globalSlug, schemaFieldsPath, blockType, parentDocumentFields, isEditable, editor, nodeKey, CustomBlockFromProps, CustomLabelFromProps]);
|
|
308
|
-
useEffect(() => {
|
|
309
|
-
return () => {
|
|
310
|
-
abortAndIgnore(onChangeAbortControllerRef.current);
|
|
311
|
-
};
|
|
312
|
-
}, []);
|
|
279
|
+
}, [applyServerState, CustomLabelFromProps, CustomBlockFromProps]);
|
|
313
280
|
const removeBlock = useCallback(() => {
|
|
314
281
|
editor.update(() => {
|
|
315
282
|
$getNodeByKey(nodeKey)?.remove();
|
|
@@ -394,7 +361,7 @@ export const BlockComponent = props => {
|
|
|
394
361
|
round: true,
|
|
395
362
|
tooltip: "Remove Block"
|
|
396
363
|
}), [baseClass, isEditable, removeBlock]);
|
|
397
|
-
const BlockCollapsible = useMemo(() => ({
|
|
364
|
+
const BlockCollapsible = useMemo(() => function BlockCollapsible({
|
|
398
365
|
Actions,
|
|
399
366
|
children: children_0,
|
|
400
367
|
className,
|
|
@@ -408,77 +375,133 @@ export const BlockComponent = props => {
|
|
|
408
375
|
removeButton,
|
|
409
376
|
showDragHandle = true,
|
|
410
377
|
showRowNumber = true
|
|
411
|
-
})
|
|
412
|
-
return /*#__PURE__*/_jsx(
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
378
|
+
}) {
|
|
379
|
+
return /*#__PURE__*/_jsx(BlockReordering, {
|
|
380
|
+
editor: editor,
|
|
381
|
+
nodeKey: nodeKey,
|
|
382
|
+
children: ({
|
|
383
|
+
isReordering,
|
|
384
|
+
move,
|
|
385
|
+
onBlur,
|
|
386
|
+
onKeyDown,
|
|
387
|
+
reorderInstructionsID,
|
|
388
|
+
targetIndex
|
|
389
|
+
}) => /*#__PURE__*/_jsx("div", {
|
|
390
|
+
className: `${baseClass}__container ${baseClass}-${blockType}`,
|
|
391
|
+
onKeyDownCapture: event => {
|
|
392
|
+
const target = event.target;
|
|
393
|
+
if (event.altKey || event.ctrlKey || event.metaKey || target.closest('.collapsible')?.parentElement !== event.currentTarget) {
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
// Handle controls before Lexical consumes keys using its retained text selection.
|
|
397
|
+
if (target.matches('.collapsible__drag') && (event.key !== 'Escape' || isReordering) && [' ', 'ArrowDown', 'ArrowUp', 'Enter', 'Escape', 'Tab'].includes(event.key)) {
|
|
398
|
+
onKeyDown(event);
|
|
399
|
+
event.stopPropagation();
|
|
400
|
+
} else if (event.key === 'Tab' && target.matches('.collapsible__toggle')) {
|
|
401
|
+
event.stopPropagation();
|
|
402
|
+
}
|
|
403
|
+
},
|
|
404
|
+
children: /*#__PURE__*/_jsxs(Collapsible, {
|
|
405
|
+
actions: typeof Actions !== 'undefined' ? Actions : isEditable ? /*#__PURE__*/_jsx(Popup, {
|
|
406
|
+
button: /*#__PURE__*/_jsx(MoreIcon, {}),
|
|
407
|
+
buttonAriaLabel: t('general:moreOptions'),
|
|
408
|
+
buttonClassName: `${baseClass}__actions-button`,
|
|
409
|
+
caret: false,
|
|
410
|
+
horizontalAlign: "right",
|
|
411
|
+
popupType: "menu",
|
|
412
|
+
render: ({
|
|
413
|
+
close
|
|
414
|
+
}) => /*#__PURE__*/_jsxs(PopupList.ButtonGroup, {
|
|
415
|
+
buttonSize: "medium",
|
|
416
|
+
children: [/*#__PURE__*/_jsx(PopupList.Button, {
|
|
417
|
+
onClick: () => {
|
|
418
|
+
close();
|
|
419
|
+
move({
|
|
420
|
+
direction: -1
|
|
421
|
+
});
|
|
422
|
+
},
|
|
423
|
+
children: t('general:moveUp')
|
|
424
|
+
}), /*#__PURE__*/_jsx(PopupList.Button, {
|
|
425
|
+
onClick: () => {
|
|
426
|
+
close();
|
|
427
|
+
move({
|
|
428
|
+
direction: 1
|
|
429
|
+
});
|
|
430
|
+
},
|
|
431
|
+
children: t('general:moveDown')
|
|
432
|
+
}), (resolvedCustomBlock && editButton !== false || !resolvedCustomBlock && editButton) && /*#__PURE__*/_jsx(PopupList.Button, {
|
|
433
|
+
onClick: () => {
|
|
434
|
+
toggleDrawer();
|
|
435
|
+
close();
|
|
436
|
+
},
|
|
437
|
+
children: t('general:edit')
|
|
438
|
+
}), removeButton !== false && /*#__PURE__*/_jsxs(PopupList.Button, {
|
|
439
|
+
onClick: () => {
|
|
440
|
+
removeBlock();
|
|
441
|
+
close();
|
|
442
|
+
},
|
|
443
|
+
children: [/*#__PURE__*/_jsx(XIcon, {}), t('general:remove')]
|
|
444
|
+
})]
|
|
445
|
+
}),
|
|
446
|
+
size: "large"
|
|
447
|
+
}) : null,
|
|
448
|
+
className: [`${baseClass}__row`, fieldHasErrors ? `${baseClass}__row--has-errors` : `${baseClass}__row--no-errors`, className].filter(Boolean).join(' '),
|
|
449
|
+
collapsibleStyle: fieldHasErrors ? 'error' : 'default',
|
|
450
|
+
dragHandleProps: showDragHandle && isEditable ? {
|
|
451
|
+
id: nodeKey,
|
|
452
|
+
attributes: {
|
|
453
|
+
'aria-describedby': reorderInstructionsID,
|
|
454
|
+
'aria-pressed': isReordering,
|
|
455
|
+
role: 'button',
|
|
456
|
+
tabIndex: 0
|
|
457
|
+
},
|
|
458
|
+
draggable: true,
|
|
459
|
+
listeners: {
|
|
460
|
+
onBlur
|
|
461
|
+
}
|
|
462
|
+
} : undefined,
|
|
463
|
+
header: /*#__PURE__*/_jsx("div", {
|
|
464
|
+
className: `${baseClass}__block-header`,
|
|
465
|
+
children: typeof Label !== 'undefined' ? Label : typeof resolvedCustomLabel !== 'undefined' ? resolvedCustomLabel : /*#__PURE__*/_jsxs("div", {
|
|
466
|
+
className: `${baseClass}__block-label`,
|
|
467
|
+
children: [showRowNumber && /*#__PURE__*/_jsx("span", {
|
|
468
|
+
className: `${baseClass}__block-number`,
|
|
469
|
+
children: String(rowIndex + 1).padStart(2, '0')
|
|
470
|
+
}), typeof CustomPill !== 'undefined' ? CustomPill : /*#__PURE__*/_jsx(Pill, {
|
|
471
|
+
className: `${baseClass}__block-pill ${baseClass}__block-pill-${blockType}`,
|
|
472
|
+
pillStyle: "white",
|
|
473
|
+
size: "small",
|
|
474
|
+
children: blockDisplayName ?? blockType
|
|
475
|
+
}), !disableBlockName && !clientBlock?.admin?.disableBlockName && /*#__PURE__*/_jsx(SectionTitle, {
|
|
476
|
+
path: "blockName",
|
|
477
|
+
readOnly: !isEditable
|
|
478
|
+
}), fieldHasErrors && /*#__PURE__*/_jsx(BlockErrorPill, {
|
|
479
|
+
count: errorCount_0 ?? 0
|
|
480
|
+
})]
|
|
481
|
+
})
|
|
437
482
|
}),
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
dragHandleProps: showDragHandle ? {
|
|
443
|
-
id: nodeKey,
|
|
444
|
-
attributes: {
|
|
445
|
-
role: 'button',
|
|
446
|
-
tabIndex: 0
|
|
483
|
+
isCollapsed: isCollapsed,
|
|
484
|
+
onToggle: incomingCollapsedState => {
|
|
485
|
+
onCollapsedChange(incomingCollapsedState);
|
|
486
|
+
setIsCollapsed(incomingCollapsedState);
|
|
447
487
|
},
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
children: [showRowNumber && /*#__PURE__*/_jsx("span", {
|
|
455
|
-
className: `${baseClass}__block-number`,
|
|
456
|
-
children: String(rowIndex + 1).padStart(2, '0')
|
|
457
|
-
}), typeof CustomPill !== 'undefined' ? CustomPill : /*#__PURE__*/_jsx(Pill, {
|
|
458
|
-
className: `${baseClass}__block-pill ${baseClass}__block-pill-${blockType}`,
|
|
459
|
-
pillStyle: "white",
|
|
460
|
-
size: "small",
|
|
461
|
-
children: blockDisplayName ?? blockType
|
|
462
|
-
}), !disableBlockName && !clientBlock?.admin?.disableBlockName && /*#__PURE__*/_jsx(SectionTitle, {
|
|
463
|
-
path: "blockName",
|
|
464
|
-
readOnly: !isEditable
|
|
465
|
-
}), fieldHasErrors && /*#__PURE__*/_jsx(ErrorPill, {
|
|
466
|
-
count: errorCount_0 ?? 0,
|
|
467
|
-
i18n: i18n,
|
|
468
|
-
withMessage: true
|
|
488
|
+
...(collapsibleProps || {}),
|
|
489
|
+
AfterCollapsible: /*#__PURE__*/_jsxs(_Fragment, {
|
|
490
|
+
children: [collapsibleProps?.AfterCollapsible, /*#__PURE__*/_jsx("span", {
|
|
491
|
+
className: "sr-only",
|
|
492
|
+
role: "status",
|
|
493
|
+
children: isReordering ? `${t('general:order')}: ${(targetIndex ?? 0) + 1}` : ''
|
|
469
494
|
})]
|
|
470
|
-
})
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
},
|
|
477
|
-
|
|
478
|
-
children: children_0
|
|
479
|
-
}, 0)
|
|
495
|
+
}),
|
|
496
|
+
children: [/*#__PURE__*/_jsxs("span", {
|
|
497
|
+
className: "sr-only",
|
|
498
|
+
id: reorderInstructionsID,
|
|
499
|
+
children: ["Space / Enter · ", t('general:moveUp'), " ↑ · ", t('general:moveDown'), " ↓ ·", ' ', t('general:cancel'), " Escape"]
|
|
500
|
+
}), children_0]
|
|
501
|
+
}, 0)
|
|
502
|
+
})
|
|
480
503
|
});
|
|
481
|
-
}, [resolvedCustomBlock, resolvedCustomLabel, blockDisplayName, baseClass, clientBlock?.admin?.disableBlockName, blockType,
|
|
504
|
+
}, [editor, resolvedCustomBlock, resolvedCustomLabel, blockDisplayName, baseClass, clientBlock?.admin?.disableBlockName, blockType, isCollapsed, onCollapsedChange, isEditable, nodeKey, removeBlock, rowIndex, t, toggleDrawer]);
|
|
482
505
|
const blockID = formData?.id;
|
|
483
506
|
const {
|
|
484
507
|
headerActions,
|
|
@@ -519,21 +542,13 @@ export const BlockComponent = props => {
|
|
|
519
542
|
display: 'contents'
|
|
520
543
|
},
|
|
521
544
|
children: /*#__PURE__*/_jsx(Form, {
|
|
522
|
-
beforeSubmit: [async ({
|
|
523
|
-
formState
|
|
524
|
-
}) => {
|
|
525
|
-
// This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component
|
|
526
|
-
return await onChange({
|
|
527
|
-
formState,
|
|
528
|
-
submit: true
|
|
529
|
-
});
|
|
530
|
-
}],
|
|
531
545
|
el: "div",
|
|
532
546
|
fields: clientBlock?.fields ?? [],
|
|
533
547
|
initialState: initialState,
|
|
534
548
|
onChange: [onChange],
|
|
535
|
-
onSubmit:
|
|
549
|
+
onSubmit: formState_0 => {
|
|
536
550
|
// This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component
|
|
551
|
+
const newData_1 = getDataFromFormState(formState_0, true);
|
|
537
552
|
newData_1.blockType = blockType;
|
|
538
553
|
editor.update(() => {
|
|
539
554
|
const node_1 = $getNodeByKey(nodeKey);
|
|
@@ -548,6 +563,8 @@ export const BlockComponent = props => {
|
|
|
548
563
|
});
|
|
549
564
|
toggleDrawer();
|
|
550
565
|
},
|
|
566
|
+
readOnly: !isEditable,
|
|
567
|
+
schemaPath: schemaFieldsPath,
|
|
551
568
|
submitted: submitted,
|
|
552
569
|
uuid: formUuid,
|
|
553
570
|
children: /*#__PURE__*/_jsx(BlockContent, {
|
|
@@ -565,7 +582,7 @@ export const BlockComponent = props => {
|
|
|
565
582
|
})
|
|
566
583
|
})
|
|
567
584
|
});
|
|
568
|
-
}, [BlockCollapsible, BlockDrawer, resolvedCustomBlock, resolvedCustomLabel, blockType, drawerSlug, RemoveButton, EditButton, baseClass, editor, errorCount, toggleDrawer, clientBlock?.fields, formUuid, initialState, nodeKey, onChange, submitted]);
|
|
585
|
+
}, [BlockCollapsible, BlockDrawer, resolvedCustomBlock, resolvedCustomLabel, blockType, drawerSlug, RemoveButton, EditButton, baseClass, editor, errorCount, toggleDrawer, clientBlock?.fields, formUuid, initialState, nodeKey, schemaFieldsPath, isEditable, onChange, submitted]);
|
|
569
586
|
if (!clientBlock) {
|
|
570
587
|
return /*#__PURE__*/_jsx(BlockCollapsible, {
|
|
571
588
|
disableBlockName: true,
|
|
@@ -578,4 +595,32 @@ export const BlockComponent = props => {
|
|
|
578
595
|
}
|
|
579
596
|
return Block;
|
|
580
597
|
};
|
|
598
|
+
/**
|
|
599
|
+
* Reads `i18n` itself so `BlockCollapsible` does not depend on it. `BlockCollapsible` is created in
|
|
600
|
+
* a `useMemo`, so each new `i18n` object (e.g. once the date-fns locale is set after mount) would
|
|
601
|
+
* remount the whole block, closing its open menus and dropping focus.
|
|
602
|
+
*/
|
|
603
|
+
const BlockErrorPill = t0 => {
|
|
604
|
+
const $ = _c(3);
|
|
605
|
+
const {
|
|
606
|
+
count
|
|
607
|
+
} = t0;
|
|
608
|
+
const {
|
|
609
|
+
i18n
|
|
610
|
+
} = useTranslation();
|
|
611
|
+
let t1;
|
|
612
|
+
if ($[0] !== count || $[1] !== i18n) {
|
|
613
|
+
t1 = _jsx(ErrorPill, {
|
|
614
|
+
count,
|
|
615
|
+
i18n,
|
|
616
|
+
withMessage: true
|
|
617
|
+
});
|
|
618
|
+
$[0] = count;
|
|
619
|
+
$[1] = i18n;
|
|
620
|
+
$[2] = t1;
|
|
621
|
+
} else {
|
|
622
|
+
t1 = $[2];
|
|
623
|
+
}
|
|
624
|
+
return t1;
|
|
625
|
+
};
|
|
581
626
|
//# sourceMappingURL=index.js.map
|