@payloadcms/richtext-lexical 3.0.0-alpha.60 → 3.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cell/index.js.map +1 -1
- package/dist/exports/components.js.map +1 -1
- package/dist/field/Field.js.map +1 -1
- package/dist/field/features/align/feature.client.js.map +1 -1
- package/dist/field/features/align/feature.server.js.map +1 -1
- package/dist/field/features/align/floatingSelectToolbarAlignDropdownSection.js.map +1 -1
- package/dist/field/features/blockquote/feature.client.js.map +1 -1
- package/dist/field/features/blockquote/feature.server.js.map +1 -1
- package/dist/field/features/blockquote/markdownTransformer.js.map +1 -1
- package/dist/field/features/blocks/component/BlockContent.js.map +1 -1
- package/dist/field/features/blocks/component/FormSavePlugin.js.map +1 -1
- package/dist/field/features/blocks/component/index.js.map +1 -1
- package/dist/field/features/blocks/component/removeEmptyArrayValues.js.map +1 -1
- package/dist/field/features/blocks/drawer/index.js.map +1 -1
- package/dist/field/features/blocks/feature.client.js.map +1 -1
- package/dist/field/features/blocks/feature.server.js.map +1 -1
- package/dist/field/features/blocks/nodes/BlocksNode.js.map +1 -1
- package/dist/field/features/blocks/plugin/commands.js.map +1 -1
- package/dist/field/features/blocks/plugin/index.js.map +1 -1
- package/dist/field/features/blocks/populationPromise.js.map +1 -1
- package/dist/field/features/blocks/validate.js.map +1 -1
- package/dist/field/features/common/floatingSelectToolbarFeaturesButtonsSection/index.js.map +1 -1
- package/dist/field/features/common/floatingSelectToolbarTextDropdownSection/index.js.map +1 -1
- package/dist/field/features/converters/html/converter/converters/linebreak.js.map +1 -1
- package/dist/field/features/converters/html/converter/converters/paragraph.js.map +1 -1
- package/dist/field/features/converters/html/converter/converters/text.js.map +1 -1
- package/dist/field/features/converters/html/converter/defaultConverters.js.map +1 -1
- package/dist/field/features/converters/html/converter/index.d.ts.map +1 -1
- package/dist/field/features/converters/html/converter/index.js +22 -17
- package/dist/field/features/converters/html/converter/index.js.map +1 -1
- package/dist/field/features/converters/html/converter/types.js.map +1 -1
- package/dist/field/features/converters/html/feature.server.js.map +1 -1
- package/dist/field/features/converters/html/field/index.js.map +1 -1
- package/dist/field/features/createClientComponent.js.map +1 -1
- package/dist/field/features/createFeaturePropComponent.js.map +1 -1
- package/dist/field/features/debug/testrecorder/feature.client.js.map +1 -1
- package/dist/field/features/debug/testrecorder/feature.server.js.map +1 -1
- package/dist/field/features/debug/testrecorder/plugin/index.js.map +1 -1
- package/dist/field/features/debug/treeview/feature.client.js.map +1 -1
- package/dist/field/features/debug/treeview/feature.server.js.map +1 -1
- package/dist/field/features/debug/treeview/plugin/index.js.map +1 -1
- package/dist/field/features/format/bold/feature.client.js.map +1 -1
- package/dist/field/features/format/bold/feature.server.js.map +1 -1
- package/dist/field/features/format/bold/markdownTransformers.js.map +1 -1
- package/dist/field/features/format/common/floatingSelectToolbarSection.js.map +1 -1
- package/dist/field/features/format/inlinecode/feature.client.js.map +1 -1
- package/dist/field/features/format/inlinecode/feature.server.js.map +1 -1
- package/dist/field/features/format/inlinecode/markdownTransformers.js.map +1 -1
- package/dist/field/features/format/italic/feature.client.js.map +1 -1
- package/dist/field/features/format/italic/feature.server.js.map +1 -1
- package/dist/field/features/format/italic/markdownTransformers.js.map +1 -1
- package/dist/field/features/format/strikethrough/feature.client.js.map +1 -1
- package/dist/field/features/format/strikethrough/feature.server.js.map +1 -1
- package/dist/field/features/format/strikethrough/markdownTransformers.js.map +1 -1
- package/dist/field/features/format/subscript/feature.client.js.map +1 -1
- package/dist/field/features/format/subscript/feature.server.js.map +1 -1
- package/dist/field/features/format/superscript/feature.client.js.map +1 -1
- package/dist/field/features/format/superscript/feature.server.js.map +1 -1
- package/dist/field/features/format/underline/feature.client.js.map +1 -1
- package/dist/field/features/format/underline/feature.server.js.map +1 -1
- package/dist/field/features/heading/feature.client.js.map +1 -1
- package/dist/field/features/heading/feature.server.js.map +1 -1
- package/dist/field/features/heading/markdownTransformer.js.map +1 -1
- package/dist/field/features/indent/feature.client.js.map +1 -1
- package/dist/field/features/indent/feature.server.js.map +1 -1
- package/dist/field/features/indent/floatingSelectToolbarIndentSection.js.map +1 -1
- package/dist/field/features/link/drawer/baseFields.d.ts.map +1 -1
- package/dist/field/features/link/drawer/baseFields.js +8 -19
- package/dist/field/features/link/drawer/baseFields.js.map +1 -1
- package/dist/field/features/link/drawer/index.js.map +1 -1
- package/dist/field/features/link/drawer/types.js.map +1 -1
- package/dist/field/features/link/feature.client.js.map +1 -1
- package/dist/field/features/link/feature.server.d.ts.map +1 -1
- package/dist/field/features/link/feature.server.js +1 -8
- package/dist/field/features/link/feature.server.js.map +1 -1
- package/dist/field/features/link/nodes/AutoLinkNode.js.map +1 -1
- package/dist/field/features/link/nodes/LinkNode.js +2 -2
- package/dist/field/features/link/nodes/LinkNode.js.map +1 -1
- package/dist/field/features/link/nodes/types.js.map +1 -1
- package/dist/field/features/link/plugins/autoLink/index.js.map +1 -1
- package/dist/field/features/link/plugins/clickableLink/index.js.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/commands.js.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.js +15 -6
- package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/index.js.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/types.d.ts +2 -0
- package/dist/field/features/link/plugins/floatingLinkEditor/types.d.ts.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/types.js.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/utilities.d.ts.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/utilities.js +2 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/utilities.js.map +1 -1
- package/dist/field/features/link/plugins/link/index.js.map +1 -1
- package/dist/field/features/link/populationPromise.js.map +1 -1
- package/dist/field/features/lists/checklist/feature.client.js.map +1 -1
- package/dist/field/features/lists/checklist/feature.server.js.map +1 -1
- package/dist/field/features/lists/checklist/markdownTransformers.js.map +1 -1
- package/dist/field/features/lists/checklist/plugin/index.js.map +1 -1
- package/dist/field/features/lists/common/markdown.js.map +1 -1
- package/dist/field/features/lists/htmlConverter.js.map +1 -1
- package/dist/field/features/lists/orderedlist/feature.client.js.map +1 -1
- package/dist/field/features/lists/orderedlist/feature.server.js.map +1 -1
- package/dist/field/features/lists/orderedlist/markdownTransformer.js.map +1 -1
- package/dist/field/features/lists/plugin/index.js.map +1 -1
- package/dist/field/features/lists/unorderedlist/feature.client.js.map +1 -1
- package/dist/field/features/lists/unorderedlist/feature.server.js.map +1 -1
- package/dist/field/features/lists/unorderedlist/markdownTransformer.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/heading/client.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/heading/converter.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/heading/index.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/link/client.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/link/converter.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/link/index.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/list/client.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/list/converter.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/list/index.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/listItem/client.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/listItem/converter.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/listItem/index.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/quote/client.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/quote/converter.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/quote/index.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/unknown/client.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/unknown/converter.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/unknown/index.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/upload/client.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/upload/index.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/defaultConverters.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/index.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/types.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/feature.client.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/feature.server.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/blockquote/client.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/blockquote/converter.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/blockquote/index.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/heading/client.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/heading/converter.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/heading/index.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/indent/client.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/indent/converter.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/indent/index.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/link/client.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/link/converter.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/link/index.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/listItem/client.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/listItem/converter.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/listItem/index.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/orderedList/client.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/orderedList/converter.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/orderedList/index.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/relationship/client.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/relationship/converter.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/relationship/index.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/unknown/client.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/unknown/converter.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/unknown/index.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/unorderedList/client.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/unorderedList/converter.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/unorderedList/index.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/upload/client.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/upload/converter.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/upload/index.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/defaultConverters.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/index.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/types.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/feature.client.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/feature.server.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
- package/dist/field/features/paragraph/feature.client.js.map +1 -1
- package/dist/field/features/paragraph/feature.server.js.map +1 -1
- package/dist/field/features/relationship/drawer/commands.js.map +1 -1
- package/dist/field/features/relationship/drawer/index.js.map +1 -1
- package/dist/field/features/relationship/feature.client.js.map +1 -1
- package/dist/field/features/relationship/feature.server.js.map +1 -1
- package/dist/field/features/relationship/nodes/RelationshipNode.js.map +1 -1
- package/dist/field/features/relationship/nodes/components/RelationshipComponent.js.map +1 -1
- package/dist/field/features/relationship/plugins/index.js.map +1 -1
- package/dist/field/features/relationship/populationPromise.js.map +1 -1
- package/dist/field/features/relationship/utils/EnabledRelationshipsCondition.js +1 -1
- package/dist/field/features/relationship/utils/EnabledRelationshipsCondition.js.map +1 -1
- package/dist/field/features/types.d.ts +6 -1
- package/dist/field/features/types.d.ts.map +1 -1
- package/dist/field/features/types.js.map +1 -1
- package/dist/field/features/upload/component/ExtraFieldsDrawer/index.js.map +1 -1
- package/dist/field/features/upload/component/index.js.map +1 -1
- package/dist/field/features/upload/drawer/commands.js.map +1 -1
- package/dist/field/features/upload/drawer/index.js.map +1 -1
- package/dist/field/features/upload/feature.client.js.map +1 -1
- package/dist/field/features/upload/feature.server.d.ts.map +1 -1
- package/dist/field/features/upload/feature.server.js +11 -4
- package/dist/field/features/upload/feature.server.js.map +1 -1
- package/dist/field/features/upload/nodes/UploadNode.js.map +1 -1
- package/dist/field/features/upload/plugin/index.js.map +1 -1
- package/dist/field/features/upload/populationPromise.js.map +1 -1
- package/dist/field/features/upload/validate.js.map +1 -1
- package/dist/field/index.js.map +1 -1
- package/dist/field/lexical/EditorPlugin.js.map +1 -1
- package/dist/field/lexical/LexicalEditor.js.map +1 -1
- package/dist/field/lexical/LexicalProvider.js.map +1 -1
- package/dist/field/lexical/config/client/EditorConfigProvider.js.map +1 -1
- package/dist/field/lexical/config/client/default.js.map +1 -1
- package/dist/field/lexical/config/client/loader.js.map +1 -1
- package/dist/field/lexical/config/client/sanitize.js.map +1 -1
- package/dist/field/lexical/config/server/default.js.map +1 -1
- package/dist/field/lexical/config/server/loader.js.map +1 -1
- package/dist/field/lexical/config/server/sanitize.js.map +1 -1
- package/dist/field/lexical/config/types.js.map +1 -1
- package/dist/field/lexical/nodes/index.js.map +1 -1
- package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarButton/index.js.map +1 -1
- package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/DropDown.js.map +1 -1
- package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/index.js.map +1 -1
- package/dist/field/lexical/plugins/FloatingSelectToolbar/index.js.map +1 -1
- package/dist/field/lexical/plugins/FloatingSelectToolbar/types.js.map +1 -1
- package/dist/field/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/index.js.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/useMenuTriggerMatch.js.map +1 -1
- package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/debounce.js.map +1 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/getBoundingRectWithoutTransform.js.map +1 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/getNodeCloseToPoint.js.map +1 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/highlightElemOriginalPosition.js.map +1 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js.map +1 -1
- package/dist/field/lexical/plugins/handles/utils/getCollapsedMargins.js.map +1 -1
- package/dist/field/lexical/plugins/handles/utils/getTopLevelNodeKeys.js.map +1 -1
- package/dist/field/lexical/plugins/handles/utils/isOnHandleElement.js.map +1 -1
- package/dist/field/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
- package/dist/field/lexical/theme/EditorTheme.js.map +1 -1
- package/dist/field/lexical/ui/ContentEditable.js.map +1 -1
- package/dist/field/lexical/ui/icons/AI/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/AlignCenter/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/AlignJustify/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/AlignLeft/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/AlignRight/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Block/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Blockquote/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Bold/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Checklist/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Code/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/CodeBlock/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/H1/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/H2/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/H3/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/H4/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/H5/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/H6/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/IndentDecrease/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/IndentIncrease/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Italic/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Link/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/OrderedList/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Relationship/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Strikethrough/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Subscript/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Superscript/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Text/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Underline/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/UnorderedList/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Upload/index.js.map +1 -1
- package/dist/field/lexical/utils/canUseDOM.js.map +1 -1
- package/dist/field/lexical/utils/cloneDeep.js.map +1 -1
- package/dist/field/lexical/utils/environment.js.map +1 -1
- package/dist/field/lexical/utils/getDOMRangeRect.js.map +1 -1
- package/dist/field/lexical/utils/getSelectedNode.js.map +1 -1
- package/dist/field/lexical/utils/guard.js.map +1 -1
- package/dist/field/lexical/utils/invariant.js.map +1 -1
- package/dist/field/lexical/utils/joinClasses.js.map +1 -1
- package/dist/field/lexical/utils/markdown/createBlockNode.js.map +1 -1
- package/dist/field/lexical/utils/nodeFormat.js.map +1 -1
- package/dist/field/lexical/utils/point.js.map +1 -1
- package/dist/field/lexical/utils/rect.js.map +1 -1
- package/dist/field/lexical/utils/setFloatingElemPosition.js.map +1 -1
- package/dist/field/lexical/utils/setFloatingElemPositionForLinkEditor.js.map +1 -1
- package/dist/field/lexical/utils/swipe.js.map +1 -1
- package/dist/field/lexical/utils/url.js.map +1 -1
- package/dist/generateComponentMap.d.ts.map +1 -1
- package/dist/generateComponentMap.js +4 -1
- package/dist/generateComponentMap.js.map +1 -1
- package/dist/generateSchemaMap.d.ts.map +1 -1
- package/dist/generateSchemaMap.js +2 -1
- package/dist/generateSchemaMap.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/populate/defaultValue.js.map +1 -1
- package/dist/populate/populate.js.map +1 -1
- package/dist/populate/recurseNestedFields.js.map +1 -1
- package/dist/populate/richTextRelationshipPromise.js.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/useLexicalFeature.js.map +1 -1
- package/dist/validate/index.js.map +1 -1
- package/dist/validate/validateNodes.js.map +1 -1
- package/package.json +10 -10
package/dist/cell/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cell/index.tsx"],"sourcesContent":["'use client'\nimport type { EditorConfig as LexicalEditorConfig } from 'lexical/LexicalEditor.js'\n\nimport lexicalHeadlessImport from '@lexical/headless'\nconst { createHeadlessEditor } = lexicalHeadlessImport\nimport lexicalImport from 'lexical'\nconst { $getRoot } = lexicalImport\nimport { useTableCell } from '@payloadcms/ui/elements/Table'\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport { useClientFunctions } from '@payloadcms/ui/providers/ClientFunction'\nimport React, { useEffect, useState } from 'react'\n\nimport type { FeatureProviderClient } from '../field/features/types.js'\nimport type { SanitizedClientEditorConfig } from '../field/lexical/config/types.js'\nimport type { GeneratedFeatureProviderComponent } from '../types.js'\n\nimport { defaultEditorLexicalConfig } from '../field/lexical/config/client/default.js'\nimport { loadClientFeatures } from '../field/lexical/config/client/loader.js'\nimport { sanitizeClientEditorConfig } from '../field/lexical/config/client/sanitize.js'\nimport { getEnabledNodes } from '../field/lexical/nodes/index.js'\n\nexport const RichTextCell: React.FC<{\n lexicalEditorConfig: LexicalEditorConfig\n}> = (props) => {\n const { lexicalEditorConfig } = props\n\n const [preview, setPreview] = React.useState('Loading...')\n const { schemaPath } = useFieldProps()\n\n const { cellData, richTextComponentMap } = useTableCell()\n\n const clientFunctions = useClientFunctions()\n const [hasLoadedFeatures, setHasLoadedFeatures] = useState(false)\n\n const [featureProviders, setFeatureProviders] = useState<FeatureProviderClient<unknown>[]>([])\n\n const [finalSanitizedEditorConfig, setFinalSanitizedEditorConfig] =\n useState<SanitizedClientEditorConfig>(null)\n\n let featureProviderComponents: GeneratedFeatureProviderComponent[] = richTextComponentMap.get(\n 'features',\n ) as GeneratedFeatureProviderComponent[] // TODO: Type better\n // order by order\n featureProviderComponents = featureProviderComponents.sort((a, b) => a.order - b.order)\n\n const featureComponentsWithFeaturesLength =\n Array.from(richTextComponentMap.keys()).filter(\n (key) => key.startsWith(`feature.`) && !key.includes('.fields.'),\n ).length + featureProviderComponents.length\n\n useEffect(() => {\n if (!hasLoadedFeatures) {\n const featureProvidersLocal: FeatureProviderClient<unknown>[] = []\n let featureProvidersAndComponentsLoaded = 0\n\n Object.entries(clientFunctions).forEach(([key, plugin]) => {\n if (key.startsWith(`lexicalFeature.${schemaPath}.`)) {\n if (!key.includes('.components.')) {\n featureProvidersLocal.push(plugin)\n }\n featureProvidersAndComponentsLoaded++\n }\n })\n\n if (featureProvidersAndComponentsLoaded === featureComponentsWithFeaturesLength) {\n setFeatureProviders(featureProvidersLocal)\n setHasLoadedFeatures(true)\n\n /**\n * Loaded feature provided => create the final sanitized editor config\n */\n\n const resolvedClientFeatures = loadClientFeatures({\n clientFunctions,\n schemaPath,\n unSanitizedEditorConfig: {\n features: featureProvidersLocal,\n lexical: lexicalEditorConfig,\n },\n })\n\n setFinalSanitizedEditorConfig(\n sanitizeClientEditorConfig(\n lexicalEditorConfig ? lexicalEditorConfig : defaultEditorLexicalConfig,\n resolvedClientFeatures,\n ),\n )\n }\n }\n }, [\n hasLoadedFeatures,\n clientFunctions,\n schemaPath,\n featureProviderComponents.length,\n featureProviders,\n finalSanitizedEditorConfig,\n lexicalEditorConfig,\n featureComponentsWithFeaturesLength,\n ])\n\n useEffect(() => {\n let dataToUse = cellData\n if (dataToUse == null || !hasLoadedFeatures || !finalSanitizedEditorConfig) {\n setPreview('')\n return\n }\n\n // Transform data through load hooks\n if (finalSanitizedEditorConfig?.features?.hooks?.load?.length) {\n finalSanitizedEditorConfig.features.hooks.load.forEach((hook) => {\n dataToUse = hook({ incomingEditorState: dataToUse })\n })\n }\n\n if (!dataToUse || typeof dataToUse !== 'object') {\n setPreview('')\n return\n }\n\n // If data is from Slate and not Lexical\n if (Array.isArray(dataToUse) && !('root' in dataToUse)) {\n setPreview('')\n return\n }\n\n // If data is from payload-plugin-lexical\n if ('jsonContent' in dataToUse) {\n setPreview('')\n return\n }\n\n // initialize headless editor\n const headlessEditor = createHeadlessEditor({\n namespace: finalSanitizedEditorConfig.lexical.namespace,\n nodes: getEnabledNodes({ editorConfig: finalSanitizedEditorConfig }),\n theme: finalSanitizedEditorConfig.lexical.theme,\n })\n headlessEditor.setEditorState(headlessEditor.parseEditorState(dataToUse))\n\n const textContent =\n headlessEditor.getEditorState().read(() => {\n return $getRoot().getTextContent()\n }) || ''\n\n // Limiting the number of characters shown is done in a CSS rule\n setPreview(textContent)\n }, [cellData, lexicalEditorConfig, hasLoadedFeatures, finalSanitizedEditorConfig])\n\n if (!hasLoadedFeatures) {\n return (\n <React.Fragment>\n {Array.isArray(featureProviderComponents) &&\n featureProviderComponents.map((featureProvider) => {\n // get all components starting with key feature.${FeatureProvider.key}.components.{featureComponentKey}\n const featureComponentKeys = Array.from(richTextComponentMap.keys()).filter((key) =>\n key.startsWith(`feature.${featureProvider.key}.components.`),\n )\n const featureComponents: React.ReactNode[] = featureComponentKeys.map((key) => {\n return richTextComponentMap.get(key)\n })\n\n return (\n <React.Fragment key={featureProvider.key}>\n {featureComponents?.length\n ? featureComponents.map((FeatureComponent) => {\n return FeatureComponent\n })\n : null}\n {featureProvider.ClientComponent}\n </React.Fragment>\n )\n })}\n </React.Fragment>\n )\n }\n\n return <span>{preview}</span>\n}\n"],"names":["lexicalHeadlessImport","createHeadlessEditor","lexicalImport","$getRoot","useTableCell","useFieldProps","useClientFunctions","React","useEffect","useState","defaultEditorLexicalConfig","loadClientFeatures","sanitizeClientEditorConfig","getEnabledNodes","RichTextCell","props","lexicalEditorConfig","preview","setPreview","schemaPath","cellData","richTextComponentMap","clientFunctions","hasLoadedFeatures","setHasLoadedFeatures","featureProviders","setFeatureProviders","finalSanitizedEditorConfig","setFinalSanitizedEditorConfig","featureProviderComponents","get","sort","a","b","order","featureComponentsWithFeaturesLength","Array","from","keys","filter","key","startsWith","includes","length","featureProvidersLocal","featureProvidersAndComponentsLoaded","Object","entries","forEach","plugin","push","resolvedClientFeatures","unSanitizedEditorConfig","features","lexical","dataToUse","hooks","load","hook","incomingEditorState","isArray","headlessEditor","namespace","nodes","editorConfig","theme","setEditorState","parseEditorState","textContent","getEditorState","read","getTextContent","Fragment","map","featureProvider","featureComponentKeys","featureComponents","FeatureComponent","ClientComponent","span"],"mappings":"AAAA;AAGA,OAAOA,2BAA2B,oBAAmB;AACrD,MAAM,EAAEC,oBAAoB,EAAE,GAAGD;AACjC,OAAOE,mBAAmB,UAAS;AACnC,MAAM,EAAEC,QAAQ,EAAE,GAAGD;AACrB,SAASE,YAAY,QAAQ,gCAA+B;AAC5D,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,kBAAkB,QAAQ,0CAAyC;AAC5E,OAAOC,SAASC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAMlD,SAASC,0BAA0B,QAAQ,4CAA2C;AACtF,SAASC,kBAAkB,QAAQ,2CAA0C;AAC7E,SAASC,0BAA0B,QAAQ,6CAA4C;AACvF,SAASC,eAAe,QAAQ,kCAAiC;AAEjE,OAAO,MAAMC,eAER,CAACC;IACJ,MAAM,EAAEC,mBAAmB,EAAE,GAAGD;IAEhC,MAAM,CAACE,SAASC,WAAW,GAAGX,MAAME,QAAQ,CAAC;IAC7C,MAAM,EAAEU,UAAU,EAAE,GAAGd;IAEvB,MAAM,EAAEe,QAAQ,EAAEC,oBAAoB,EAAE,GAAGjB;IAE3C,MAAMkB,kBAAkBhB;IACxB,MAAM,CAACiB,mBAAmBC,qBAAqB,GAAGf,SAAS;IAE3D,MAAM,CAACgB,kBAAkBC,oBAAoB,GAAGjB,SAA2C,EAAE;IAE7F,MAAM,CAACkB,4BAA4BC,8BAA8B,GAC/DnB,SAAsC;IAEx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;YAEA,qBACE,oBAACjC,MAAMiE,QAAQ;gBAAChC,KAAKkC,gBAAgBlC,GAAG;eACrCoC,mBAAmBjC,SAChBiC,kBAAkBH,GAAG,CAAC,CAACI;gBACrB,OAAOA;YACT,KACA,MACHH,gBAAgBI,eAAe;QAGtC;IAGR;IAEA,qBAAO,oBAACC,cAAM9D;AAChB,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../src/cell/index.tsx"],"sourcesContent":["'use client'\nimport type { EditorConfig as LexicalEditorConfig } from 'lexical/LexicalEditor.js'\n\nimport lexicalHeadlessImport from '@lexical/headless'\nconst { createHeadlessEditor } = lexicalHeadlessImport\nimport lexicalImport from 'lexical'\nconst { $getRoot } = lexicalImport\nimport { useTableCell } from '@payloadcms/ui/elements/Table'\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport { useClientFunctions } from '@payloadcms/ui/providers/ClientFunction'\nimport React, { useEffect, useState } from 'react'\n\nimport type { FeatureProviderClient } from '../field/features/types.js'\nimport type { SanitizedClientEditorConfig } from '../field/lexical/config/types.js'\nimport type { GeneratedFeatureProviderComponent } from '../types.js'\n\nimport { defaultEditorLexicalConfig } from '../field/lexical/config/client/default.js'\nimport { loadClientFeatures } from '../field/lexical/config/client/loader.js'\nimport { sanitizeClientEditorConfig } from '../field/lexical/config/client/sanitize.js'\nimport { getEnabledNodes } from '../field/lexical/nodes/index.js'\n\nexport const RichTextCell: React.FC<{\n lexicalEditorConfig: LexicalEditorConfig\n}> = (props) => {\n const { lexicalEditorConfig } = props\n\n const [preview, setPreview] = React.useState('Loading...')\n const { schemaPath } = useFieldProps()\n\n const { cellData, richTextComponentMap } = useTableCell()\n\n const clientFunctions = useClientFunctions()\n const [hasLoadedFeatures, setHasLoadedFeatures] = useState(false)\n\n const [featureProviders, setFeatureProviders] = useState<FeatureProviderClient<unknown>[]>([])\n\n const [finalSanitizedEditorConfig, setFinalSanitizedEditorConfig] =\n useState<SanitizedClientEditorConfig>(null)\n\n let featureProviderComponents: GeneratedFeatureProviderComponent[] = richTextComponentMap.get(\n 'features',\n ) as GeneratedFeatureProviderComponent[] // TODO: Type better\n // order by order\n featureProviderComponents = featureProviderComponents.sort((a, b) => a.order - b.order)\n\n const featureComponentsWithFeaturesLength =\n Array.from(richTextComponentMap.keys()).filter(\n (key) => key.startsWith(`feature.`) && !key.includes('.fields.'),\n ).length + featureProviderComponents.length\n\n useEffect(() => {\n if (!hasLoadedFeatures) {\n const featureProvidersLocal: FeatureProviderClient<unknown>[] = []\n let featureProvidersAndComponentsLoaded = 0\n\n Object.entries(clientFunctions).forEach(([key, plugin]) => {\n if (key.startsWith(`lexicalFeature.${schemaPath}.`)) {\n if (!key.includes('.components.')) {\n featureProvidersLocal.push(plugin)\n }\n featureProvidersAndComponentsLoaded++\n }\n })\n\n if (featureProvidersAndComponentsLoaded === featureComponentsWithFeaturesLength) {\n setFeatureProviders(featureProvidersLocal)\n setHasLoadedFeatures(true)\n\n /**\n * Loaded feature provided => create the final sanitized editor config\n */\n\n const resolvedClientFeatures = loadClientFeatures({\n clientFunctions,\n schemaPath,\n unSanitizedEditorConfig: {\n features: featureProvidersLocal,\n lexical: lexicalEditorConfig,\n },\n })\n\n setFinalSanitizedEditorConfig(\n sanitizeClientEditorConfig(\n lexicalEditorConfig ? lexicalEditorConfig : defaultEditorLexicalConfig,\n resolvedClientFeatures,\n ),\n )\n }\n }\n }, [\n hasLoadedFeatures,\n clientFunctions,\n schemaPath,\n featureProviderComponents.length,\n featureProviders,\n finalSanitizedEditorConfig,\n lexicalEditorConfig,\n featureComponentsWithFeaturesLength,\n ])\n\n useEffect(() => {\n let dataToUse = cellData\n if (dataToUse == null || !hasLoadedFeatures || !finalSanitizedEditorConfig) {\n setPreview('')\n return\n }\n\n // Transform data through load hooks\n if (finalSanitizedEditorConfig?.features?.hooks?.load?.length) {\n finalSanitizedEditorConfig.features.hooks.load.forEach((hook) => {\n dataToUse = hook({ incomingEditorState: dataToUse })\n })\n }\n\n if (!dataToUse || typeof dataToUse !== 'object') {\n setPreview('')\n return\n }\n\n // If data is from Slate and not Lexical\n if (Array.isArray(dataToUse) && !('root' in dataToUse)) {\n setPreview('')\n return\n }\n\n // If data is from payload-plugin-lexical\n if ('jsonContent' in dataToUse) {\n setPreview('')\n return\n }\n\n // initialize headless editor\n const headlessEditor = createHeadlessEditor({\n namespace: finalSanitizedEditorConfig.lexical.namespace,\n nodes: getEnabledNodes({ editorConfig: finalSanitizedEditorConfig }),\n theme: finalSanitizedEditorConfig.lexical.theme,\n })\n headlessEditor.setEditorState(headlessEditor.parseEditorState(dataToUse))\n\n const textContent =\n headlessEditor.getEditorState().read(() => {\n return $getRoot().getTextContent()\n }) || ''\n\n // Limiting the number of characters shown is done in a CSS rule\n setPreview(textContent)\n }, [cellData, lexicalEditorConfig, hasLoadedFeatures, finalSanitizedEditorConfig])\n\n if (!hasLoadedFeatures) {\n return (\n <React.Fragment>\n {Array.isArray(featureProviderComponents) &&\n featureProviderComponents.map((featureProvider) => {\n // get all components starting with key feature.${FeatureProvider.key}.components.{featureComponentKey}\n const featureComponentKeys = Array.from(richTextComponentMap.keys()).filter((key) =>\n key.startsWith(`feature.${featureProvider.key}.components.`),\n )\n const featureComponents: React.ReactNode[] = featureComponentKeys.map((key) => {\n return richTextComponentMap.get(key)\n })\n\n return (\n <React.Fragment key={featureProvider.key}>\n {featureComponents?.length\n ? featureComponents.map((FeatureComponent) => {\n return FeatureComponent\n })\n : null}\n {featureProvider.ClientComponent}\n </React.Fragment>\n )\n })}\n </React.Fragment>\n )\n }\n\n return <span>{preview}</span>\n}\n"],"names":["lexicalHeadlessImport","createHeadlessEditor","lexicalImport","$getRoot","useTableCell","useFieldProps","useClientFunctions","React","useEffect","useState","defaultEditorLexicalConfig","loadClientFeatures","sanitizeClientEditorConfig","getEnabledNodes","RichTextCell","props","lexicalEditorConfig","preview","setPreview","schemaPath","cellData","richTextComponentMap","clientFunctions","hasLoadedFeatures","setHasLoadedFeatures","featureProviders","setFeatureProviders","finalSanitizedEditorConfig","setFinalSanitizedEditorConfig","featureProviderComponents","get","sort","a","b","order","featureComponentsWithFeaturesLength","Array","from","keys","filter","key","startsWith","includes","length","featureProvidersLocal","featureProvidersAndComponentsLoaded","Object","entries","forEach","plugin","push","resolvedClientFeatures","unSanitizedEditorConfig","features","lexical","dataToUse","hooks","load","hook","incomingEditorState","isArray","headlessEditor","namespace","nodes","editorConfig","theme","setEditorState","parseEditorState","textContent","getEditorState","read","getTextContent","Fragment","map","featureProvider","featureComponentKeys","featureComponents","FeatureComponent","ClientComponent","span"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAGA,OAAOA,2BAA2B,oBAAmB;AACrD,MAAM,EAAEC,oBAAoB,EAAE,GAAGD;AACjC,OAAOE,mBAAmB,UAAS;AACnC,MAAM,EAAEC,QAAQ,EAAE,GAAGD;AACrB,SAASE,YAAY,QAAQ,gCAA+B;AAC5D,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,kBAAkB,QAAQ,0CAAyC;AAC5E,OAAOC,SAASC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAMlD,SAASC,0BAA0B,QAAQ,4CAA2C;AACtF,SAASC,kBAAkB,QAAQ,2CAA0C;AAC7E,SAASC,0BAA0B,QAAQ,6CAA4C;AACvF,SAASC,eAAe,QAAQ,kCAAiC;AAEjE,OAAO,MAAMC,eAER,CAACC;IACJ,MAAM,EAAEC,mBAAmB,EAAE,GAAGD;IAEhC,MAAM,CAACE,SAASC,WAAW,GAAGX,MAAME,QAAQ,CAAC;IAC7C,MAAM,EAAEU,UAAU,EAAE,GAAGd;IAEvB,MAAM,EAAEe,QAAQ,EAAEC,oBAAoB,EAAE,GAAGjB;IAE3C,MAAMkB,kBAAkBhB;IACxB,M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AU,CAAC,CAAC,QAAQ,EAAEiC,gBAAgBlC,GAAG,CAAC,YAAY,CAAC;YAE7D,MAAMoC,oBAAuCD,qBAAqBF,GAAG,CAAC,CAACjC;gBACrE,OAAOnB,qBAAqBS,GAAG,CAACU;YAClC;YAEA,qBACE,oBAACjC,MAAMiE,QAAQ;gBAAChC,KAAKkC,gBAAgBlC,GAAG;eACrCoC,mBAAmBjC,SAChBiC,kBAAkBH,GAAG,CAAC,CAACI;gBACrB,OAAOA;YACT,KACA,MACHH,gBAAgBI,eAAe;QAGtC;IAGR;IAEA,qBAAO,oBAACC,cAAM9D;AAChB,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exports/components.ts"],"sourcesContent":["export { RichTextCell } from '../cell/index.js'\nexport { RichTextField } from '../field/index.js'\n\nexport { defaultEditorLexicalConfig } from '../field/lexical/config/client/default.js'\nexport { ToolbarButton } from '../field/lexical/plugins/FloatingSelectToolbar/ToolbarButton/index.js'\nexport { ToolbarDropdown } from '../field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/index.js'\n"],"names":["RichTextCell","RichTextField","defaultEditorLexicalConfig","ToolbarButton","ToolbarDropdown"],"mappings":"AAAA,SAASA,YAAY,QAAQ,mBAAkB;AAC/C,SAASC,aAAa,QAAQ,oBAAmB;AAEjD,SAASC,0BAA0B,QAAQ,4CAA2C;AACtF,SAASC,aAAa,QAAQ,wEAAuE;AACrG,SAASC,eAAe,QAAQ,0EAAyE"}
|
|
1
|
+
{"version":3,"sources":["../../src/exports/components.ts"],"sourcesContent":["export { RichTextCell } from '../cell/index.js'\nexport { RichTextField } from '../field/index.js'\n\nexport { defaultEditorLexicalConfig } from '../field/lexical/config/client/default.js'\nexport { ToolbarButton } from '../field/lexical/plugins/FloatingSelectToolbar/ToolbarButton/index.js'\nexport { ToolbarDropdown } from '../field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/index.js'\n"],"names":["RichTextCell","RichTextField","defaultEditorLexicalConfig","ToolbarButton","ToolbarDropdown"],"rangeMappings":";;;;","mappings":"AAAA,SAASA,YAAY,QAAQ,mBAAkB;AAC/C,SAASC,aAAa,QAAQ,oBAAmB;AAEjD,SAASC,0BAA0B,QAAQ,4CAA2C;AACtF,SAASC,aAAa,QAAQ,wEAAuE;AACrG,SAASC,eAAe,QAAQ,0EAAyE"}
|
package/dist/field/Field.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/field/Field.tsx"],"sourcesContent":["'use client'\nimport type { FormFieldBase } from '@payloadcms/ui/fields/shared'\nimport type { SerializedEditorState } from 'lexical'\nimport type { FieldBase } from 'payload/types'\n\nimport { FieldDescription } from '@payloadcms/ui/forms/FieldDescription'\nimport { FieldError } from '@payloadcms/ui/forms/FieldError'\nimport { FieldLabel } from '@payloadcms/ui/forms/FieldLabel'\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport { useField } from '@payloadcms/ui/forms/useField'\nimport { withCondition } from '@payloadcms/ui/forms/withCondition'\nimport React, { useCallback } from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\n\nimport type { SanitizedClientEditorConfig } from './lexical/config/types.js'\n\nimport './index.scss'\nimport { LexicalProvider } from './lexical/LexicalProvider.js'\n\nconst baseClass = 'rich-text-lexical'\n\nconst _RichText: React.FC<\n FormFieldBase & {\n editorConfig: SanitizedClientEditorConfig // With rendered features n stuff\n label?: FieldBase['label']\n name: string\n richTextComponentMap: Map<string, React.ReactNode>\n width?: string\n }\n> = (props) => {\n const {\n name,\n CustomDescription,\n CustomError,\n CustomLabel,\n className,\n descriptionProps,\n editorConfig,\n errorProps,\n label,\n labelProps,\n path: pathFromProps,\n readOnly,\n required,\n style,\n validate, // Users can pass in client side validation if they WANT to, but it's not required anymore\n width,\n } = props\n\n const memoizedValidate = useCallback(\n (value, validationOptions) => {\n if (typeof validate === 'function') {\n return validate(value, { ...validationOptions, props, required })\n }\n },\n // Important: do not add props to the dependencies array.\n // This would cause an infinite loop and endless re-rendering.\n // Removing props from the dependencies array fixed this issue: https://github.com/payloadcms/payload/issues/3709\n [validate, required],\n )\n const { path: pathFromContext } = useFieldProps()\n\n const fieldType = useField<SerializedEditorState>({\n path: pathFromContext || pathFromProps || name,\n validate: memoizedValidate,\n })\n\n const { errorMessage, initialValue, path, schemaPath, setValue, showError, value } = fieldType\n\n const classes = [\n baseClass,\n 'field-type',\n className,\n showError && 'error',\n readOnly && `${baseClass}--read-only`,\n ]\n .filter(Boolean)\n .join(' ')\n\n return (\n <div\n className={classes}\n key={path}\n style={{\n ...style,\n width,\n }}\n >\n <div className={`${baseClass}__wrap`}>\n <FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />\n <FieldLabel\n CustomLabel={CustomLabel}\n label={label}\n required={required}\n {...(labelProps || {})}\n />\n <ErrorBoundary fallbackRender={fallbackRender} onReset={() => {}}>\n <LexicalProvider\n editorConfig={editorConfig}\n fieldProps={props}\n key={JSON.stringify({ initialValue, path })} // makes sure lexical is completely re-rendered when initialValue changes, bypassing the lexical-internal value memoization. That way, external changes to the form will update the editor. More infos in PR description (https://github.com/payloadcms/payload/pull/5010)\n onChange={(editorState) => {\n let serializedEditorState = editorState.toJSON()\n\n // Transform state through save hooks\n if (editorConfig?.features?.hooks?.save?.length) {\n editorConfig.features.hooks.save.forEach((hook) => {\n serializedEditorState = hook({ incomingEditorState: serializedEditorState })\n })\n }\n\n setValue(serializedEditorState)\n }}\n path={path}\n readOnly={readOnly}\n value={value}\n />\n </ErrorBoundary>\n {CustomDescription !== undefined ? (\n CustomDescription\n ) : (\n <FieldDescription {...(descriptionProps || {})} />\n )}\n </div>\n </div>\n )\n}\n\nfunction fallbackRender({ error }): React.ReactElement {\n // Call resetErrorBoundary() to reset the error boundary and retry the render.\n\n return (\n <div className=\"errorBoundary\" role=\"alert\">\n <p>Something went wrong:</p>\n <pre style={{ color: 'red' }}>{error.message}</pre>\n </div>\n )\n}\n\nexport const RichText = withCondition(_RichText)\n"],"names":["FieldDescription","FieldError","FieldLabel","useFieldProps","useField","withCondition","React","useCallback","ErrorBoundary","LexicalProvider","baseClass","_RichText","props","name","CustomDescription","CustomError","CustomLabel","className","descriptionProps","editorConfig","errorProps","label","labelProps","path","pathFromProps","readOnly","required","style","validate","width","memoizedValidate","value","validationOptions","pathFromContext","fieldType","errorMessage","initialValue","schemaPath","setValue","showError","classes","filter","Boolean","join","div","key","fallbackRender","onReset","fieldProps","JSON","stringify","onChange","editorState","serializedEditorState","toJSON","features","hooks","save","length","forEach","hook","incomingEditorState","undefined","error","role","p","pre","color","message","RichText"],"mappings":"AAAA;AAKA,SAASA,gBAAgB,QAAQ,wCAAuC;AACxE,SAASC,UAAU,QAAQ,kCAAiC;AAC5D,SAASC,UAAU,QAAQ,kCAAiC;AAC5D,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,aAAa,QAAQ,qCAAoC;AAClE,OAAOC,SAASC,WAAW,QAAQ,QAAO;AAC1C,SAASC,aAAa,QAAQ,uBAAsB;AAIpD,OAAO,eAAc;AACrB,SAASC,eAAe,QAAQ,+BAA8B;AAE9D,MAAMC,YAAY;AAElB,MAAMC,YAQF,CAACC;IACH,MAAM,EACJC,IAAI,EACJC,iBAAiB,EACjBC,WAAW,EACXC,WAAW,EACXC,SAAS,EACTC,gBAAgB,EAChBC,YAAY,EACZC,UAAU,EACVC,KAAK,EACLC,UAAU,EACVC,MAAMC,aAAa,EACnBC,QAAQ,EACRC,QAAQ,EACRC,KAAK,EACLC,QAAQ,EACRC,KAAK,EACN,GAAGjB;IAEJ,MAAMkB,mBAAmBvB,YACvB,CAACwB,OAAOC;QACN,IAAI,OAAOJ,aAAa,YAAY;YAClC,OAAOA,SAASG,OAAO;gBAAE,GAAGC,iBAAiB;gBAAEpB;gBAAOc;YAAS;QACjE;IACF,GACA,yDAAyD;IACzD,8DAA8D;IAC9D,iHAAiH;IACjH;QAACE;QAAUF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kB,oBAAoB,CAAC;AAKtD;AAEA,SAAS4B,eAAe,EAAEiB,KAAK,EAAE;IAC/B,8EAA8E;IAE9E,qBACE,oBAACnB;QAAI3B,WAAU;QAAgB+C,MAAK;qBAClC,oBAACC,WAAE,wCACH,oBAACC;QAAIvC,OAAO;YAAEwC,OAAO;QAAM;OAAIJ,MAAMK,OAAO;AAGlD;AAEA,OAAO,MAAMC,WAAWhE,cAAcM,WAAU"}
|
|
1
|
+
{"version":3,"sources":["../../src/field/Field.tsx"],"sourcesContent":["'use client'\nimport type { FormFieldBase } from '@payloadcms/ui/fields/shared'\nimport type { SerializedEditorState } from 'lexical'\nimport type { FieldBase } from 'payload/types'\n\nimport { FieldDescription } from '@payloadcms/ui/forms/FieldDescription'\nimport { FieldError } from '@payloadcms/ui/forms/FieldError'\nimport { FieldLabel } from '@payloadcms/ui/forms/FieldLabel'\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport { useField } from '@payloadcms/ui/forms/useField'\nimport { withCondition } from '@payloadcms/ui/forms/withCondition'\nimport React, { useCallback } from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\n\nimport type { SanitizedClientEditorConfig } from './lexical/config/types.js'\n\nimport './index.scss'\nimport { LexicalProvider } from './lexical/LexicalProvider.js'\n\nconst baseClass = 'rich-text-lexical'\n\nconst _RichText: React.FC<\n FormFieldBase & {\n editorConfig: SanitizedClientEditorConfig // With rendered features n stuff\n label?: FieldBase['label']\n name: string\n richTextComponentMap: Map<string, React.ReactNode>\n width?: string\n }\n> = (props) => {\n const {\n name,\n CustomDescription,\n CustomError,\n CustomLabel,\n className,\n descriptionProps,\n editorConfig,\n errorProps,\n label,\n labelProps,\n path: pathFromProps,\n readOnly,\n required,\n style,\n validate, // Users can pass in client side validation if they WANT to, but it's not required anymore\n width,\n } = props\n\n const memoizedValidate = useCallback(\n (value, validationOptions) => {\n if (typeof validate === 'function') {\n return validate(value, { ...validationOptions, props, required })\n }\n },\n // Important: do not add props to the dependencies array.\n // This would cause an infinite loop and endless re-rendering.\n // Removing props from the dependencies array fixed this issue: https://github.com/payloadcms/payload/issues/3709\n [validate, required],\n )\n const { path: pathFromContext } = useFieldProps()\n\n const fieldType = useField<SerializedEditorState>({\n path: pathFromContext || pathFromProps || name,\n validate: memoizedValidate,\n })\n\n const { errorMessage, initialValue, path, schemaPath, setValue, showError, value } = fieldType\n\n const classes = [\n baseClass,\n 'field-type',\n className,\n showError && 'error',\n readOnly && `${baseClass}--read-only`,\n ]\n .filter(Boolean)\n .join(' ')\n\n return (\n <div\n className={classes}\n key={path}\n style={{\n ...style,\n width,\n }}\n >\n <div className={`${baseClass}__wrap`}>\n <FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />\n <FieldLabel\n CustomLabel={CustomLabel}\n label={label}\n required={required}\n {...(labelProps || {})}\n />\n <ErrorBoundary fallbackRender={fallbackRender} onReset={() => {}}>\n <LexicalProvider\n editorConfig={editorConfig}\n fieldProps={props}\n key={JSON.stringify({ initialValue, path })} // makes sure lexical is completely re-rendered when initialValue changes, bypassing the lexical-internal value memoization. That way, external changes to the form will update the editor. More infos in PR description (https://github.com/payloadcms/payload/pull/5010)\n onChange={(editorState) => {\n let serializedEditorState = editorState.toJSON()\n\n // Transform state through save hooks\n if (editorConfig?.features?.hooks?.save?.length) {\n editorConfig.features.hooks.save.forEach((hook) => {\n serializedEditorState = hook({ incomingEditorState: serializedEditorState })\n })\n }\n\n setValue(serializedEditorState)\n }}\n path={path}\n readOnly={readOnly}\n value={value}\n />\n </ErrorBoundary>\n {CustomDescription !== undefined ? (\n CustomDescription\n ) : (\n <FieldDescription {...(descriptionProps || {})} />\n )}\n </div>\n </div>\n )\n}\n\nfunction fallbackRender({ error }): React.ReactElement {\n // Call resetErrorBoundary() to reset the error boundary and retry the render.\n\n return (\n <div className=\"errorBoundary\" role=\"alert\">\n <p>Something went wrong:</p>\n <pre style={{ color: 'red' }}>{error.message}</pre>\n </div>\n )\n}\n\nexport const RichText = withCondition(_RichText)\n"],"names":["FieldDescription","FieldError","FieldLabel","useFieldProps","useField","withCondition","React","useCallback","ErrorBoundary","LexicalProvider","baseClass","_RichText","props","name","CustomDescription","CustomError","CustomLabel","className","descriptionProps","editorConfig","errorProps","label","labelProps","path","pathFromProps","readOnly","required","style","validate","width","memoizedValidate","value","validationOptions","pathFromContext","fieldType","errorMessage","initialValue","schemaPath","setValue","showError","classes","filter","Boolean","join","div","key","fallbackRender","onReset","fieldProps","JSON","stringify","onChange","editorState","serializedEditorState","toJSON","features","hooks","save","length","forEach","hook","incomingEditorState","undefined","error","role","p","pre","color","message","RichText"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAKA,SAASA,gBAAgB,QAAQ,wCAAuC;AACxE,SAASC,UAAU,QAAQ,kCAAiC;AAC5D,SAASC,UAAU,QAAQ,kCAAiC;AAC5D,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,aAAa,QAAQ,qCAAoC;AAClE,OAAOC,SAASC,WAAW,QAAQ,QAAO;AAC1C,SAASC,aAAa,QAAQ,uBAAsB;AAIpD,OAAO,eAAc;AACrB,SAASC,eAAe,QAAQ,+BAA8B;AAE9D,MAAMC,YAAY;AAElB,MAAMC,YAQF,CAACC;IACH,MAAM,EACJC,IAAI,EACJC,iBAAiB,EACjBC,WAAW,EACXC,WAAW,EACXC,SAAS,EACTC,gBAAgB,EAChBC,YAAY,EACZC,UAAU,EACVC,KAAK,EACLC,UAAU,EACVC,MAAMC,aAAa,EACnBC,QAAQ,EACRC,QAAQ,EACRC,KAAK,EACLC,QAAQ,EACRC,KAAK,EACN,GAAGjB;IAEJ,MAAMkB,mBAAmBvB,YACvB,CAACwB,OAAOC;QACN,IAAI,OAAOJ,aAAa,YAAY;YAClC,OAAOA,SAASG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AsB;gBAC5E;YACF;YAEAf,SAASe;QACX;QACA9B,MAAMA;QACNE,UAAUA;QACVM,OAAOA;SAGVjB,sBAAsBgD,YACrBhD,kCAEA,oBAACd,kBAAsBkB,oBAAoB,CAAC;AAKtD;AAEA,SAAS4B,eAAe,EAAEiB,KAAK,EAAE;IAC/B,8EAA8E;IAE9E,qBACE,oBAACnB;QAAI3B,WAAU;QAAgB+C,MAAK;qBAClC,oBAACC,WAAE,wCACH,oBAACC;QAAIvC,OAAO;YAAEwC,OAAO;QAAM;OAAIJ,MAAMK,OAAO;AAGlD;AAEA,OAAO,MAAMC,WAAWhE,cAAcM,WAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/field/features/align/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport lexicalImport from 'lexical'\nconst { FORMAT_ELEMENT_COMMAND } = lexicalImport\n\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { AlignCenterIcon } from '../../lexical/ui/icons/AlignCenter/index.js'\nimport { AlignJustifyIcon } from '../../lexical/ui/icons/AlignJustify/index.js'\nimport { AlignLeftIcon } from '../../lexical/ui/icons/AlignLeft/index.js'\nimport { AlignRightIcon } from '../../lexical/ui/icons/AlignRight/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { AlignDropdownSectionWithEntries } from './floatingSelectToolbarAlignDropdownSection.js'\n\nconst AlignFeatureClient: FeatureProviderProviderClient<undefined> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n floatingSelectToolbar: {\n sections: [\n AlignDropdownSectionWithEntries([\n {\n ChildComponent: AlignLeftIcon,\n isActive: () => false,\n key: 'align-left',\n label: `Align Left`,\n onClick: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'left')\n },\n order: 1,\n },\n ]),\n AlignDropdownSectionWithEntries([\n {\n ChildComponent: AlignCenterIcon,\n isActive: () => false,\n key: 'align-center',\n label: `Align Center`,\n onClick: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'center')\n },\n order: 2,\n },\n ]),\n AlignDropdownSectionWithEntries([\n {\n ChildComponent: AlignRightIcon,\n isActive: () => false,\n key: 'align-right',\n label: `Align Right`,\n onClick: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'right')\n },\n order: 3,\n },\n ]),\n AlignDropdownSectionWithEntries([\n {\n ChildComponent: AlignJustifyIcon,\n isActive: () => false,\n key: 'align-justify',\n label: `Align Justify`,\n onClick: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'justify')\n },\n order: 4,\n },\n ]),\n ],\n },\n }),\n }\n}\n\nexport const AlignFeatureClientComponent = createClientComponent(AlignFeatureClient)\n"],"names":["lexicalImport","FORMAT_ELEMENT_COMMAND","AlignCenterIcon","AlignJustifyIcon","AlignLeftIcon","AlignRightIcon","createClientComponent","AlignDropdownSectionWithEntries","AlignFeatureClient","props","clientFeatureProps","feature","floatingSelectToolbar","sections","ChildComponent","isActive","key","label","onClick","editor","dispatchCommand","order","AlignFeatureClientComponent"],"mappings":"AAAA;AAEA,OAAOA,mBAAmB,UAAS;AACnC,MAAM,EAAEC,sBAAsB,EAAE,GAAGD;AAInC,SAASE,eAAe,QAAQ,8CAA6C;AAC7E,SAASC,gBAAgB,QAAQ,+CAA8C;AAC/E,SAASC,aAAa,QAAQ,4CAA2C;AACzE,SAASC,cAAc,QAAQ,6CAA4C;AAC3E,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,+BAA+B,QAAQ,iDAAgD;AAEhG,MAAMC,qBAA+D,CAACC;IACpE,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,uBAAuB;oBACrBC,UAAU;wBACRN,gCAAgC;4BAC9B;gCACEO,gBAAgBV;gCAChBW,UAAU,IAAM;gCAChBC,KAAK;gCACLC,OAAO,CAAC,UAAU,CAAC;gCACnBC,SAAS,CAAC,EAAEC,MAAM,EAAE;oCAClBA,OAAOC,eAAe,CAACnB,wBAAwB;gCACjD;gCACAoB,OAAO;4BACT;yBACD;wBACDd,gCAAgC;4BAC9B;gCACEO,gBAAgBZ;gCAChBa,UAAU,IAAM;gCAChBC,KAAK;gCACLC,OAAO,CAAC,YAAY,CAAC;gCACrBC,SAAS,CAAC,EAAEC,MAAM,EAAE;oCAClBA,OAAOC,eAAe,CAACnB,wBAAwB;gCACjD;gCACAoB,OAAO;4BACT;yBACD;wBACDd,gCAAgC;4BAC9B;gCACEO,gBAAgBT;gCAChBU,UAAU,IAAM;gCAChBC,KAAK;gCACLC,OAAO,CAAC,WAAW,CAAC;gCACpBC,SAAS,CAAC,EAAEC,MAAM,EAAE;oCAClBA,OAAOC,eAAe,CAACnB,wBAAwB;gCACjD;gCACAoB,OAAO;4BACT;yBACD;wBACDd,gCAAgC;4BAC9B;gCACEO,gBAAgBX;gCAChBY,UAAU,IAAM;gCAChBC,KAAK;gCACLC,OAAO,CAAC,aAAa,CAAC;gCACtBC,SAAS,CAAC,EAAEC,MAAM,EAAE;oCAClBA,OAAOC,eAAe,CAACnB,wBAAwB;gCACjD;gCACAoB,OAAO;4BACT;yBACD;qBACF;gBACH;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAMC,8BAA8BhB,sBAAsBE,oBAAmB"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/features/align/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport lexicalImport from 'lexical'\nconst { FORMAT_ELEMENT_COMMAND } = lexicalImport\n\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { AlignCenterIcon } from '../../lexical/ui/icons/AlignCenter/index.js'\nimport { AlignJustifyIcon } from '../../lexical/ui/icons/AlignJustify/index.js'\nimport { AlignLeftIcon } from '../../lexical/ui/icons/AlignLeft/index.js'\nimport { AlignRightIcon } from '../../lexical/ui/icons/AlignRight/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { AlignDropdownSectionWithEntries } from './floatingSelectToolbarAlignDropdownSection.js'\n\nconst AlignFeatureClient: FeatureProviderProviderClient<undefined> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n floatingSelectToolbar: {\n sections: [\n AlignDropdownSectionWithEntries([\n {\n ChildComponent: AlignLeftIcon,\n isActive: () => false,\n key: 'align-left',\n label: `Align Left`,\n onClick: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'left')\n },\n order: 1,\n },\n ]),\n AlignDropdownSectionWithEntries([\n {\n ChildComponent: AlignCenterIcon,\n isActive: () => false,\n key: 'align-center',\n label: `Align Center`,\n onClick: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'center')\n },\n order: 2,\n },\n ]),\n AlignDropdownSectionWithEntries([\n {\n ChildComponent: AlignRightIcon,\n isActive: () => false,\n key: 'align-right',\n label: `Align Right`,\n onClick: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'right')\n },\n order: 3,\n },\n ]),\n AlignDropdownSectionWithEntries([\n {\n ChildComponent: AlignJustifyIcon,\n isActive: () => false,\n key: 'align-justify',\n label: `Align Justify`,\n onClick: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'justify')\n },\n order: 4,\n },\n ]),\n ],\n },\n }),\n }\n}\n\nexport const AlignFeatureClientComponent = createClientComponent(AlignFeatureClient)\n"],"names":["lexicalImport","FORMAT_ELEMENT_COMMAND","AlignCenterIcon","AlignJustifyIcon","AlignLeftIcon","AlignRightIcon","createClientComponent","AlignDropdownSectionWithEntries","AlignFeatureClient","props","clientFeatureProps","feature","floatingSelectToolbar","sections","ChildComponent","isActive","key","label","onClick","editor","dispatchCommand","order","AlignFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","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,OAAOC,eAAe,CAACnB,wBAAwB;gCACjD;gCACAoB,OAAO;4BACT;yBACD;qBACF;gBACH;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAMC,8BAA8BhB,sBAAsBE,oBAAmB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/field/features/align/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../types.js'\n\nimport { AlignFeatureClientComponent } from './feature.client.js'\n\nexport const AlignFeature: FeatureProviderProviderServer<undefined, undefined> = (props) => {\n return {\n feature: () => {\n return {\n ClientComponent: AlignFeatureClientComponent,\n clientFeatureProps: null,\n serverFeatureProps: props,\n }\n },\n key: 'align',\n serverFeatureProps: props,\n }\n}\n"],"names":["AlignFeatureClientComponent","AlignFeature","props","feature","ClientComponent","clientFeatureProps","serverFeatureProps","key"],"mappings":"AAEA,SAASA,2BAA2B,QAAQ,sBAAqB;AAEjE,OAAO,MAAMC,eAAoE,CAACC;IAChF,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBJ;gBACjBK,oBAAoB;gBACpBC,oBAAoBJ;YACtB;QACF;QACAK,KAAK;QACLD,oBAAoBJ;IACtB;AACF,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/features/align/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../types.js'\n\nimport { AlignFeatureClientComponent } from './feature.client.js'\n\nexport const AlignFeature: FeatureProviderProviderServer<undefined, undefined> = (props) => {\n return {\n feature: () => {\n return {\n ClientComponent: AlignFeatureClientComponent,\n clientFeatureProps: null,\n serverFeatureProps: props,\n }\n },\n key: 'align',\n serverFeatureProps: props,\n }\n}\n"],"names":["AlignFeatureClientComponent","AlignFeature","props","feature","ClientComponent","clientFeatureProps","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;","mappings":"AAEA,SAASA,2BAA2B,QAAQ,sBAAqB;AAEjE,OAAO,MAAMC,eAAoE,CAACC;IAChF,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBJ;gBACjBK,oBAAoB;gBACpBC,oBAAoBJ;YACtB;QACF;QACAK,KAAK;QACLD,oBAAoBJ;IACtB;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/field/features/align/floatingSelectToolbarAlignDropdownSection.ts"],"sourcesContent":["import type {\n FloatingToolbarSection,\n FloatingToolbarSectionEntry,\n} from '../../lexical/plugins/FloatingSelectToolbar/types.js'\n\nimport { AlignLeftIcon } from '../../lexical/ui/icons/AlignLeft/index.js'\n\nexport const AlignDropdownSectionWithEntries = (\n entries: FloatingToolbarSectionEntry[],\n): FloatingToolbarSection => {\n return {\n type: 'dropdown',\n ChildComponent: AlignLeftIcon,\n entries,\n key: 'dropdown-align',\n order: 2,\n }\n}\n"],"names":["AlignLeftIcon","AlignDropdownSectionWithEntries","entries","type","ChildComponent","key","order"],"mappings":"AAKA,SAASA,aAAa,QAAQ,4CAA2C;AAEzE,OAAO,MAAMC,kCAAkC,CAC7CC;IAEA,OAAO;QACLC,MAAM;QACNC,gBAAgBJ;QAChBE;QACAG,KAAK;QACLC,OAAO;IACT;AACF,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/features/align/floatingSelectToolbarAlignDropdownSection.ts"],"sourcesContent":["import type {\n FloatingToolbarSection,\n FloatingToolbarSectionEntry,\n} from '../../lexical/plugins/FloatingSelectToolbar/types.js'\n\nimport { AlignLeftIcon } from '../../lexical/ui/icons/AlignLeft/index.js'\n\nexport const AlignDropdownSectionWithEntries = (\n entries: FloatingToolbarSectionEntry[],\n): FloatingToolbarSection => {\n return {\n type: 'dropdown',\n ChildComponent: AlignLeftIcon,\n entries,\n key: 'dropdown-align',\n order: 2,\n }\n}\n"],"names":["AlignLeftIcon","AlignDropdownSectionWithEntries","entries","type","ChildComponent","key","order"],"rangeMappings":";;;;;;;;;","mappings":"AAKA,SAASA,aAAa,QAAQ,4CAA2C;AAEzE,OAAO,MAAMC,kCAAkC,CAC7CC;IAEA,OAAO;QACLC,MAAM;QACNC,gBAAgBJ;QAChBE;QACAG,KAAK;QACLC,OAAO;IACT;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/field/features/blockquote/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport lexicalRichTextImport from '@lexical/rich-text'\nconst { $createQuoteNode, QuoteNode } = lexicalRichTextImport\n\nimport lexicalSelectionImport from '@lexical/selection'\nconst { $setBlocksType } = lexicalSelectionImport\n\nimport lexicalImport from 'lexical'\nconst { $getSelection } = lexicalImport\n\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { SlashMenuOption } from '../../lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js'\nimport { BlockquoteIcon } from '../../lexical/ui/icons/Blockquote/index.js'\nimport { TextDropdownSectionWithEntries } from '../common/floatingSelectToolbarTextDropdownSection/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\n\nconst BlockQuoteFeatureClient: FeatureProviderProviderClient<undefined> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n floatingSelectToolbar: {\n sections: [\n TextDropdownSectionWithEntries([\n {\n ChildComponent: BlockquoteIcon,\n isActive: () => false,\n key: 'blockquote',\n label: `Blockquote`,\n onClick: ({ editor }) => {\n editor.update(() => {\n const selection = $getSelection()\n $setBlocksType(selection, () => $createQuoteNode())\n })\n },\n order: 20,\n },\n ]),\n ],\n },\n markdownTransformers: [MarkdownTransformer],\n\n nodes: [QuoteNode],\n slashMenu: {\n options: [\n {\n displayName: 'Basic',\n key: 'basic',\n options: [\n new SlashMenuOption(`blockquote`, {\n Icon: BlockquoteIcon,\n displayName: `Blockquote`,\n keywords: ['quote', 'blockquote'],\n onSelect: () => {\n const selection = $getSelection()\n $setBlocksType(selection, () => $createQuoteNode())\n },\n }),\n ],\n },\n ],\n },\n }),\n }\n}\n\nexport const BlockQuoteFeatureClientComponent = createClientComponent(BlockQuoteFeatureClient)\n"],"names":["lexicalRichTextImport","$createQuoteNode","QuoteNode","lexicalSelectionImport","$setBlocksType","lexicalImport","$getSelection","SlashMenuOption","BlockquoteIcon","TextDropdownSectionWithEntries","createClientComponent","MarkdownTransformer","BlockQuoteFeatureClient","props","clientFeatureProps","feature","floatingSelectToolbar","sections","ChildComponent","isActive","key","label","onClick","editor","update","selection","order","markdownTransformers","nodes","slashMenu","options","displayName","Icon","keywords","onSelect","BlockQuoteFeatureClientComponent"],"mappings":"AAAA;AAEA,OAAOA,2BAA2B,qBAAoB;AACtD,MAAM,EAAEC,gBAAgB,EAAEC,SAAS,EAAE,GAAGF;AAExC,OAAOG,4BAA4B,qBAAoB;AACvD,MAAM,EAAEC,cAAc,EAAE,GAAGD;AAE3B,OAAOE,mBAAmB,UAAS;AACnC,MAAM,EAAEC,aAAa,EAAE,GAAGD;AAI1B,SAASE,eAAe,QAAQ,sEAAqE;AACrG,SAASC,cAAc,QAAQ,6CAA4C;AAC3E,SAASC,8BAA8B,QAAQ,8DAA6D;AAC5G,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,mBAAmB,QAAQ,2BAA0B;AAE9D,MAAMC,0BAAoE,CAACC;IACzE,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,uBAAuB;oBACrBC,UAAU;wBACRR,+BAA+B;4BAC7B;gCACES,gBAAgBV;gCAChBW,UAAU,IAAM;gCAChBC,KAAK;gCACLC,OAAO,CAAC,UAAU,CAAC;gCACnBC,SAAS,CAAC,EAAEC,MAAM,EAAE;oCAClBA,OAAOC,MAAM,CAAC;wCACZ,MAAMC,YAAYnB;wCAClBF,eAAeqB,WAAW,IAAMxB;oCAClC;gCACF;gCACAyB,OAAO;4BACT;yBACD;qBACF;gBACH;gBACAC,sBAAsB;oBAAChB;iBAAoB;gBAE3CiB,OAAO;oBAAC1B;iBAAU;gBAClB2B,WAAW;oBACTC,SAAS;wBACP;4BACEC,aAAa;4BACbX,KAAK;4BACLU,SAAS;gCACP,IAAIvB,gBAAgB,CAAC,UAAU,CAAC,EAAE;oCAChCyB,MAAMxB;oCACNuB,aAAa,CAAC,UAAU,CAAC;oCACzBE,UAAU;wCAAC;wCAAS;qCAAa;oCACjCC,UAAU;wCACR,MAAMT,YAAYnB;wCAClBF,eAAeqB,WAAW,IAAMxB;oCAClC;gCACF;6BACD;wBACH;qBACD;gBACH;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAMkC,mCAAmCzB,sBAAsBE,yBAAwB"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/features/blockquote/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport lexicalRichTextImport from '@lexical/rich-text'\nconst { $createQuoteNode, QuoteNode } = lexicalRichTextImport\n\nimport lexicalSelectionImport from '@lexical/selection'\nconst { $setBlocksType } = lexicalSelectionImport\n\nimport lexicalImport from 'lexical'\nconst { $getSelection } = lexicalImport\n\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { SlashMenuOption } from '../../lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js'\nimport { BlockquoteIcon } from '../../lexical/ui/icons/Blockquote/index.js'\nimport { TextDropdownSectionWithEntries } from '../common/floatingSelectToolbarTextDropdownSection/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\n\nconst BlockQuoteFeatureClient: FeatureProviderProviderClient<undefined> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n floatingSelectToolbar: {\n sections: [\n TextDropdownSectionWithEntries([\n {\n ChildComponent: BlockquoteIcon,\n isActive: () => false,\n key: 'blockquote',\n label: `Blockquote`,\n onClick: ({ editor }) => {\n editor.update(() => {\n const selection = $getSelection()\n $setBlocksType(selection, () => $createQuoteNode())\n })\n },\n order: 20,\n },\n ]),\n ],\n },\n markdownTransformers: [MarkdownTransformer],\n\n nodes: [QuoteNode],\n slashMenu: {\n options: [\n {\n displayName: 'Basic',\n key: 'basic',\n options: [\n new SlashMenuOption(`blockquote`, {\n Icon: BlockquoteIcon,\n displayName: `Blockquote`,\n keywords: ['quote', 'blockquote'],\n onSelect: () => {\n const selection = $getSelection()\n $setBlocksType(selection, () => $createQuoteNode())\n },\n }),\n ],\n },\n ],\n },\n }),\n }\n}\n\nexport const BlockQuoteFeatureClientComponent = createClientComponent(BlockQuoteFeatureClient)\n"],"names":["lexicalRichTextImport","$createQuoteNode","QuoteNode","lexicalSelectionImport","$setBlocksType","lexicalImport","$getSelection","SlashMenuOption","BlockquoteIcon","TextDropdownSectionWithEntries","createClientComponent","MarkdownTransformer","BlockQuoteFeatureClient","props","clientFeatureProps","feature","floatingSelectToolbar","sections","ChildComponent","isActive","key","label","onClick","editor","update","selection","order","markdownTransformers","nodes","slashMenu","options","displayName","Icon","keywords","onSelect","BlockQuoteFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAEA,OAAOA,2BAA2B,qBAAoB;AACtD,MAAM,EAAEC,gBAAgB,EAAEC,SAAS,EAAE,GAAGF;AAExC,OAAOG,4BAA4B,qBAAoB;AACvD,MAAM,EAAEC,cAAc,EAAE,GAAGD;AAE3B,OAAOE,mBAAmB,UAAS;AACnC,MAAM,EAAEC,aAAa,EAAE,GAAGD;AAI1B,SAASE,eAAe,QAAQ,sEAAqE;AACrG,SAASC,cAAc,QAAQ,6CAA4C;AAC3E,SAASC,8BAA8B,QAAQ,8DAA6D;AAC5G,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,mBAAmB,QAAQ,2BAA0B;AAE9D,MAAMC,0BAAoE,CAACC;IACzE,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,uBAAuB;oBACrBC,UAAU;wBACRR,+BAA+B;4BAC7B;gCACES,gBAAgBV;gCAChBW,UAAU,IAAM;gCAChBC,KAAK;gCACLC,OAAO,CAAC,UAAU,CAAC;gCACnBC,SAAS,CAAC,EAAEC,MAAM,EAAE;oCAClBA,OAAOC,MAAM,CAAC;wCACZ,MAAMC,YAAYnB;wCAClBF,eAAeqB,WAAW,IAAMxB;oCAClC;gCACF;gCACAyB,OAAO;4BACT;yBACD;qBACF;gBACH;gBACAC,sBAAsB;oBAAChB;iBAAoB;gBAE3CiB,OAAO;oBAAC1B;iBAAU;gBAClB2B,WAAW;oBACTC,SAAS;wBACP;4BACEC,aAAa;4BACbX,KAAK;4BACLU,SAAS;gCACP,IAAIvB,gBAAgB,CAAC,UAAU,CAAC,EAAE;oCAChCyB,MAAMxB;oCACNuB,aAAa,CAAC,UAAU,CAAC;oCACzBE,UAAU;wCAAC;wCAAS;qCAAa;oCACjCC,UAAU;wCACR,MAAMT,YAAYnB;wCAClBF,eAAeqB,WAAW,IAAMxB;oCAClC;gCACF;6BACD;wBACH;qBACD;gBACH;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAMkC,mCAAmCzB,sBAAsBE,yBAAwB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/field/features/blockquote/feature.server.ts"],"sourcesContent":["import lexicalRichTextImport, { type SerializedQuoteNode } from '@lexical/rich-text'\nconst { QuoteNode } = lexicalRichTextImport\n\nimport type { HTMLConverter } from '../converters/html/converter/types.js'\nimport type { FeatureProviderProviderServer } from '../types.js'\n\nimport { convertLexicalNodesToHTML } from '../converters/html/converter/index.js'\nimport { BlockQuoteFeatureClientComponent } from './feature.client.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\n\nexport const BlockQuoteFeature: FeatureProviderProviderServer<undefined, undefined> = (props) => {\n return {\n feature: () => {\n return {\n ClientComponent: BlockQuoteFeatureClientComponent,\n clientFeatureProps: null,\n markdownTransformers: [MarkdownTransformer],\n nodes: [\n {\n converters: {\n html: {\n converter: async ({ converters, node, parent, payload }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n lexicalNodes: node.children,\n parent: {\n ...node,\n parent,\n },\n payload,\n })\n\n return `<blockquote>${childrenText}</blockquote>`\n },\n nodeTypes: [QuoteNode.getType()],\n } as HTMLConverter<SerializedQuoteNode>,\n },\n node: QuoteNode,\n },\n ],\n serverFeatureProps: props,\n }\n },\n key: 'blockquote',\n serverFeatureProps: props,\n }\n}\n"],"names":["lexicalRichTextImport","QuoteNode","convertLexicalNodesToHTML","BlockQuoteFeatureClientComponent","MarkdownTransformer","BlockQuoteFeature","props","feature","ClientComponent","clientFeatureProps","markdownTransformers","nodes","converters","html","converter","node","parent","payload","childrenText","lexicalNodes","children","nodeTypes","getType","serverFeatureProps","key"],"mappings":"AAAA,OAAOA,2BAAyD,qBAAoB;AACpF,MAAM,EAAEC,SAAS,EAAE,GAAGD;AAKtB,SAASE,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,gCAAgC,QAAQ,sBAAqB;AACtE,SAASC,mBAAmB,QAAQ,2BAA0B;AAE9D,OAAO,MAAMC,oBAAyE,CAACC;IACrF,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBL;gBACjBM,oBAAoB;gBACpBC,sBAAsB;oBAACN;iBAAoB;gBAC3CO,OAAO;oBACL;wBACEC,YAAY;4BACVC,MAAM;gCACJC,WAAW,OAAO,EAAEF,UAAU,EAAEG,IAAI,EAAEC,MAAM,EAAEC,OAAO,EAAE;oCACrD,MAAMC,eAAe,MAAMhB,0BAA0B;wCACnDU;wCACAO,cAAcJ,KAAKK,QAAQ;wCAC3BJ,QAAQ;4CACN,GAAGD,IAAI;4CACPC;wCACF;wCACAC;oCACF;oCAEA,OAAO,CAAC,YAAY,EAAEC,aAAa,aAAa,CAAC;gCACnD;gCACAG,WAAW;oCAACpB,UAAUqB,OAAO;iCAAG;4BAClC;wBACF;wBACAP,MAAMd;oBACR;iBACD;gBACDsB,oBAAoBjB;YACtB;QACF;QACAkB,KAAK;QACLD,oBAAoBjB;IACtB;AACF,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/features/blockquote/feature.server.ts"],"sourcesContent":["import lexicalRichTextImport, { type SerializedQuoteNode } from '@lexical/rich-text'\nconst { QuoteNode } = lexicalRichTextImport\n\nimport type { HTMLConverter } from '../converters/html/converter/types.js'\nimport type { FeatureProviderProviderServer } from '../types.js'\n\nimport { convertLexicalNodesToHTML } from '../converters/html/converter/index.js'\nimport { BlockQuoteFeatureClientComponent } from './feature.client.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\n\nexport const BlockQuoteFeature: FeatureProviderProviderServer<undefined, undefined> = (props) => {\n return {\n feature: () => {\n return {\n ClientComponent: BlockQuoteFeatureClientComponent,\n clientFeatureProps: null,\n markdownTransformers: [MarkdownTransformer],\n nodes: [\n {\n converters: {\n html: {\n converter: async ({ converters, node, parent, payload }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n lexicalNodes: node.children,\n parent: {\n ...node,\n parent,\n },\n payload,\n })\n\n return `<blockquote>${childrenText}</blockquote>`\n },\n nodeTypes: [QuoteNode.getType()],\n } as HTMLConverter<SerializedQuoteNode>,\n },\n node: QuoteNode,\n },\n ],\n serverFeatureProps: props,\n }\n },\n key: 'blockquote',\n serverFeatureProps: props,\n }\n}\n"],"names":["lexicalRichTextImport","QuoteNode","convertLexicalNodesToHTML","BlockQuoteFeatureClientComponent","MarkdownTransformer","BlockQuoteFeature","props","feature","ClientComponent","clientFeatureProps","markdownTransformers","nodes","converters","html","converter","node","parent","payload","childrenText","lexicalNodes","children","nodeTypes","getType","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,2BAAyD,qBAAoB;AACpF,MAAM,EAAEC,SAAS,EAAE,GAAGD;AAKtB,SAASE,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,gCAAgC,QAAQ,sBAAqB;AACtE,SAASC,mBAAmB,QAAQ,2BAA0B;AAE9D,OAAO,MAAMC,oBAAyE,CAACC;IACrF,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBL;gBACjBM,oBAAoB;gBACpBC,sBAAsB;oBAACN;iBAAoB;gBAC3CO,OAAO;oBACL;wBACEC,YAAY;4BACVC,MAAM;gCACJC,WAAW,OAAO,EAAEF,UAAU,EAAEG,IAAI,EAAEC,MAAM,EAAEC,OAAO,EAAE;oCACrD,MAAMC,eAAe,MAAMhB,0BAA0B;wCACnDU;wCACAO,cAAcJ,KAAKK,QAAQ;wCAC3BJ,QAAQ;4CACN,GAAGD,IAAI;4CACPC;wCACF;wCACAC;oCACF;oCAEA,OAAO,CAAC,YAAY,EAAEC,aAAa,aAAa,CAAC;gCACnD;gCACAG,WAAW;oCAACpB,UAAUqB,OAAO;iCAAG;4BAClC;wBACF;wBACAP,MAAMd;oBACR;iBACD;gBACDsB,oBAAoBjB;YACtB;QACF;QACAkB,KAAK;QACLD,oBAAoBjB;IACtB;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/field/features/blockquote/markdownTransformer.ts"],"sourcesContent":["import type { ElementTransformer } from '@lexical/markdown'\n\nimport lexicalRichTextImport from '@lexical/rich-text'\nconst { $createQuoteNode, $isQuoteNode, QuoteNode } = lexicalRichTextImport\n\nimport lexicalImport from 'lexical'\nconst { $createLineBreakNode } = lexicalImport\n\nexport const MarkdownTransformer: ElementTransformer = {\n type: 'element',\n dependencies: [QuoteNode],\n export: (node, exportChildren) => {\n if (!$isQuoteNode(node)) {\n return null\n }\n\n const lines = exportChildren(node).split('\\n')\n const output = []\n for (const line of lines) {\n output.push('> ' + line)\n }\n return output.join('\\n')\n },\n regExp: /^>\\s/,\n replace: (parentNode, children, _match, isImport) => {\n if (isImport) {\n const previousNode = parentNode.getPreviousSibling()\n if ($isQuoteNode(previousNode)) {\n previousNode.splice(previousNode.getChildrenSize(), 0, [\n $createLineBreakNode(),\n ...children,\n ])\n previousNode.select(0, 0)\n parentNode.remove()\n return\n }\n }\n\n const node = $createQuoteNode()\n node.append(...children)\n parentNode.replace(node)\n node.select(0, 0)\n },\n}\n"],"names":["lexicalRichTextImport","$createQuoteNode","$isQuoteNode","QuoteNode","lexicalImport","$createLineBreakNode","MarkdownTransformer","type","dependencies","export","node","exportChildren","lines","split","output","line","push","join","regExp","replace","parentNode","children","_match","isImport","previousNode","getPreviousSibling","splice","getChildrenSize","select","remove","append"],"mappings":"AAEA,OAAOA,2BAA2B,qBAAoB;AACtD,MAAM,EAAEC,gBAAgB,EAAEC,YAAY,EAAEC,SAAS,EAAE,GAAGH;AAEtD,OAAOI,mBAAmB,UAAS;AACnC,MAAM,EAAEC,oBAAoB,EAAE,GAAGD;AAEjC,OAAO,MAAME,sBAA0C;IACrDC,MAAM;IACNC,cAAc;QAACL;KAAU;IACzBM,QAAQ,CAACC,MAAMC;QACb,IAAI,CAACT,aAAaQ,OAAO;YACvB,OAAO;QACT;QAEA,MAAME,QAAQD,eAAeD,MAAMG,KAAK,CAAC;QACzC,MAAMC,SAAS,EAAE;QACjB,KAAK,MAAMC,QAAQH,MAAO;YACxBE,OAAOE,IAAI,CAAC,OAAOD;QACrB;QACA,OAAOD,OAAOG,IAAI,CAAC;IACrB;IACAC,QAAQ;IACRC,SAAS,CAACC,YAAYC,UAAUC,QAAQC;QACtC,IAAIA,UAAU;YACZ,MAAMC,eAAeJ,WAAWK,kBAAkB;YAClD,IAAIvB,aAAasB,eAAe;gBAC9BA,aAAaE,MAAM,CAACF,aAAaG,eAAe,IAAI,GAAG;oBACrDtB;uBACGgB;iBACJ;gBACDG,aAAaI,MAAM,CAAC,GAAG;gBACvBR,WAAWS,MAAM;gBACjB;YACF;QACF;QAEA,MAAMnB,OAAOT;QACbS,KAAKoB,MAAM,IAAIT;QACfD,WAAWD,OAAO,CAACT;QACnBA,KAAKkB,MAAM,CAAC,GAAG;IACjB;AACF,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/features/blockquote/markdownTransformer.ts"],"sourcesContent":["import type { ElementTransformer } from '@lexical/markdown'\n\nimport lexicalRichTextImport from '@lexical/rich-text'\nconst { $createQuoteNode, $isQuoteNode, QuoteNode } = lexicalRichTextImport\n\nimport lexicalImport from 'lexical'\nconst { $createLineBreakNode } = lexicalImport\n\nexport const MarkdownTransformer: ElementTransformer = {\n type: 'element',\n dependencies: [QuoteNode],\n export: (node, exportChildren) => {\n if (!$isQuoteNode(node)) {\n return null\n }\n\n const lines = exportChildren(node).split('\\n')\n const output = []\n for (const line of lines) {\n output.push('> ' + line)\n }\n return output.join('\\n')\n },\n regExp: /^>\\s/,\n replace: (parentNode, children, _match, isImport) => {\n if (isImport) {\n const previousNode = parentNode.getPreviousSibling()\n if ($isQuoteNode(previousNode)) {\n previousNode.splice(previousNode.getChildrenSize(), 0, [\n $createLineBreakNode(),\n ...children,\n ])\n previousNode.select(0, 0)\n parentNode.remove()\n return\n }\n }\n\n const node = $createQuoteNode()\n node.append(...children)\n parentNode.replace(node)\n node.select(0, 0)\n },\n}\n"],"names":["lexicalRichTextImport","$createQuoteNode","$isQuoteNode","QuoteNode","lexicalImport","$createLineBreakNode","MarkdownTransformer","type","dependencies","export","node","exportChildren","lines","split","output","line","push","join","regExp","replace","parentNode","children","_match","isImport","previousNode","getPreviousSibling","splice","getChildrenSize","select","remove","append"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,OAAOA,2BAA2B,qBAAoB;AACtD,MAAM,EAAEC,gBAAgB,EAAEC,YAAY,EAAEC,SAAS,EAAE,GAAGH;AAEtD,OAAOI,mBAAmB,UAAS;AACnC,MAAM,EAAEC,oBAAoB,EAAE,GAAGD;AAEjC,OAAO,MAAME,sBAA0C;IACrDC,MAAM;IACNC,cAAc;QAACL;KAAU;IACzBM,QAAQ,CAACC,MAAMC;QACb,IAAI,CAACT,aAAaQ,OAAO;YACvB,OAAO;QACT;QAEA,MAAME,QAAQD,eAAeD,MAAMG,KAAK,CAAC;QACzC,MAAMC,SAAS,EAAE;QACjB,KAAK,MAAMC,QAAQH,MAAO;YACxBE,OAAOE,IAAI,CAAC,OAAOD;QACrB;QACA,OAAOD,OAAOG,IAAI,CAAC;IACrB;IACAC,QAAQ;IACRC,SAAS,CAACC,YAAYC,UAAUC,QAAQC;QACtC,IAAIA,UAAU;YACZ,MAAMC,eAAeJ,WAAWK,kBAAkB;YAClD,IAAIvB,aAAasB,eAAe;gBAC9BA,aAAaE,MAAM,CAACF,aAAaG,eAAe,IAAI,GAAG;oBACrDtB;uBACGgB;iBACJ;gBACDG,aAAaI,MAAM,CAAC,GAAG;gBACvBR,WAAWS,MAAM;gBACjB;YACF;QACF;QAEA,MAAMnB,OAAOT;QACbS,KAAKoB,MAAM,IAAIT;QACfD,WAAWD,OAAO,CAACT;QACnBA,KAAKkB,MAAM,CAAC,GAAG;IACjB;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/features/blocks/component/BlockContent.tsx"],"sourcesContent":["import type { FormState } from 'payload/types'\nimport type { Data } from 'payload/types'\n\nimport lexicalComposerContextImport from '@lexical/react/LexicalComposerContext.js'\nconst { useLexicalComposerContext } = lexicalComposerContextImport\nimport { getTranslation } from '@payloadcms/translations'\nimport isDeepEqual from 'deep-equal'\nimport lexicalImport from 'lexical'\nconst { $getNodeByKey } = lexicalImport\nimport type { FormFieldBase } from '@payloadcms/ui/fields/shared'\nimport type { FieldMap, ReducedBlock } from '@payloadcms/ui/utilities/buildComponentMap'\nimport type { CollapsedPreferences } from 'payload/types'\n\nimport { Button } from '@payloadcms/ui/elements/Button'\nimport { Collapsible } from '@payloadcms/ui/elements/Collapsible'\nimport { ErrorPill } from '@payloadcms/ui/elements/ErrorPill'\nimport { Pill } from '@payloadcms/ui/elements/Pill'\nimport { SectionTitle } from '@payloadcms/ui/fields/Blocks/SectionTitle'\nimport { useFormSubmitted } from '@payloadcms/ui/forms/Form'\nimport { RenderFields } from '@payloadcms/ui/forms/RenderFields'\nimport { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport React, { useCallback } from 'react'\n\nimport type { SanitizedClientEditorConfig } from '../../../lexical/config/types.js'\nimport type { BlockFields, BlockNode } from '../nodes/BlocksNode.js'\n\nimport { FormSavePlugin } from './FormSavePlugin.js'\n\ntype Props = {\n baseClass: string\n field: FormFieldBase & {\n editorConfig: SanitizedClientEditorConfig // With rendered features n stuff\n name: string\n richTextComponentMap: Map<string, React.ReactNode>\n }\n formData: BlockFields\n formSchema: FieldMap\n nodeKey: string\n path: string\n reducedBlock: ReducedBlock\n schemaPath: string\n}\n\n/**\n * The actual content of the Block. This should be INSIDE a Form component,\n * scoped to the block. All format operations in here are thus scoped to the block's form, and\n * not the whole document.\n */\nexport const BlockContent: React.FC<Props> = (props) => {\n const {\n baseClass,\n field,\n formData,\n formSchema,\n nodeKey,\n path,\n reducedBlock: { labels },\n schemaPath,\n } = props\n\n const { i18n } = useTranslation()\n const [editor] = useLexicalComposerContext()\n // Used for saving collapsed to preferences (and gettin' it from there again)\n // Remember, these preferences are scoped to the whole document, not just this form. This\n // is important to consider for the data path used in setDocFieldPreferences\n const { getDocPreferences, setDocFieldPreferences } = useDocumentInfo()\n\n const [isCollapsed, setIsCollapsed] = React.useState<boolean>(() => {\n let initialState = false\n\n void getDocPreferences().then((currentDocPreferences) => {\n const currentFieldPreferences = currentDocPreferences?.fields[field.name]\n\n const collapsedArray = currentFieldPreferences?.collapsed\n\n if (collapsedArray && collapsedArray.includes(formData.id)) {\n initialState = true\n setIsCollapsed(true)\n }\n })\n return initialState\n })\n\n const hasSubmitted = useFormSubmitted()\n\n const [errorCount, setErrorCount] = React.useState(0)\n\n const fieldHasErrors = hasSubmitted && errorCount > 0\n\n const classNames = [\n `${baseClass}__row`,\n fieldHasErrors ? `${baseClass}__row--has-errors` : `${baseClass}__row--no-errors`,\n ]\n .filter(Boolean)\n .join(' ')\n\n const onFormChange = useCallback(\n ({\n fullFieldsWithValues,\n newFormData,\n }: {\n fullFieldsWithValues: FormState\n newFormData: Data\n }) => {\n newFormData = {\n ...newFormData,\n id: formData.id,\n blockType: formData.blockType,\n }\n\n // Recursively remove all undefined values from even being present in formData, as they will\n // cause isDeepEqual to return false if, for example, formData has a key that fields.data\n // does not have, even if it's undefined.\n // Currently, this happens if a block has another sub-blocks field. Inside formData, that sub-blocks field has an undefined blockName property.\n // Inside of fields.data however, that sub-blocks blockName property does not exist at all.\n function removeUndefinedAndNullRecursively(obj: object) {\n Object.keys(obj).forEach((key) => {\n if (obj[key] && typeof obj[key] === 'object') {\n removeUndefinedAndNullRecursively(obj[key])\n } else if (obj[key] === undefined || obj[key] === null) {\n delete obj[key]\n }\n })\n }\n removeUndefinedAndNullRecursively(newFormData)\n removeUndefinedAndNullRecursively(formData)\n\n // Only update if the data has actually changed. Otherwise, we may be triggering an unnecessary value change,\n // which would trigger the \"Leave without saving\" dialog unnecessarily\n if (!isDeepEqual(formData, newFormData)) {\n // Running this in the next tick in the meantime fixes this issue: https://github.com/payloadcms/payload/issues/4108\n // I don't know why. When this is called immediately, it might focus out of a nested lexical editor field if an update is made there.\n // My hypothesis is that the nested editor might not have fully finished its update cycle yet. By updating in the next tick, we\n // ensure that the nested editor has finished its update cycle before we update the block node.\n setTimeout(() => {\n editor.update(() => {\n const node: BlockNode = $getNodeByKey(nodeKey)\n if (node) {\n node.setFields(newFormData as BlockFields)\n }\n })\n }, 0)\n }\n\n // update error count\n if (hasSubmitted) {\n let rowErrorCount = 0\n for (const formField of Object.values(fullFieldsWithValues)) {\n if (formField?.valid === false) {\n rowErrorCount++\n }\n }\n setErrorCount(rowErrorCount)\n }\n },\n [editor, nodeKey, hasSubmitted, formData],\n )\n\n const onCollapsedChange = useCallback(\n (changedCollapsed: boolean) => {\n void getDocPreferences().then((currentDocPreferences) => {\n const currentFieldPreferences = currentDocPreferences?.fields[field.name]\n\n const collapsedArray = currentFieldPreferences?.collapsed\n\n const newCollapsed: CollapsedPreferences =\n collapsedArray && collapsedArray?.length ? collapsedArray : []\n\n if (changedCollapsed) {\n if (!newCollapsed.includes(formData.id)) {\n newCollapsed.push(formData.id)\n }\n } else {\n if (newCollapsed.includes(formData.id)) {\n newCollapsed.splice(newCollapsed.indexOf(formData.id), 1)\n }\n }\n\n setDocFieldPreferences(field.name, {\n collapsed: newCollapsed,\n hello: 'hi',\n })\n })\n },\n [getDocPreferences, field.name, setDocFieldPreferences, formData.id],\n )\n\n const removeBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey).remove()\n })\n }, [editor, nodeKey])\n\n return (\n <React.Fragment>\n <Collapsible\n className={classNames}\n collapsibleStyle={fieldHasErrors ? 'error' : 'default'}\n header={\n <div className={`${baseClass}__block-header`}>\n <div>\n <Pill\n className={`${baseClass}__block-pill ${baseClass}__block-pill-${formData?.blockType}`}\n pillStyle=\"white\"\n >\n {typeof labels.singular === 'string'\n ? getTranslation(labels.singular, i18n)\n : '[Singular Label]'}\n </Pill>\n <SectionTitle path=\"blockName\" readOnly={field?.readOnly} />\n {fieldHasErrors && <ErrorPill count={errorCount} i18n={i18n} withMessage />}\n </div>\n {editor.isEditable() && (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={field?.readOnly}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeBlock()\n }}\n round\n tooltip=\"Remove Block\"\n />\n )}\n </div>\n }\n isCollapsed={isCollapsed}\n key={0}\n onToggle={(incomingCollapsedState) => {\n onCollapsedChange(incomingCollapsedState)\n setIsCollapsed(incomingCollapsedState)\n }}\n >\n <RenderFields\n className={`${baseClass}__fields`}\n fieldMap={Array.isArray(formSchema) ? formSchema : []}\n forceRender\n margins=\"small\"\n path=\"\" // Leaving path empty makes it so field values are not prefixed / scoped by the entire schemaPath. e.g. we can access \"myField\" instead of \"someLexicalField.feature.blocks.someArrayB\" // TODO: Could there be any implications leaving path different than schemaPath?\n readOnly={false}\n schemaPath={schemaPath} // Having the correct schemaPath here allows sub-fields (like array > addRow) to run correct form-state calls and retrieve their needed form state from the server\n />\n </Collapsible>\n\n <FormSavePlugin onChange={onFormChange} />\n </React.Fragment>\n )\n}\n"],"names":["lexicalComposerContextImport","useLexicalComposerContext","getTranslation","isDeepEqual","lexicalImport","$getNodeByKey","Button","Collapsible","ErrorPill","Pill","SectionTitle","useFormSubmitted","RenderFields","useDocumentInfo","useTranslation","React","useCallback","FormSavePlugin","BlockContent","props","baseClass","field","formData","formSchema","nodeKey","path","reducedBlock","labels","schemaPath","i18n","editor","getDocPreferences","setDocFieldPreferences","isCollapsed","setIsCollapsed","useState","initialState","then","currentDocPreferences","currentFieldPreferences","fields","name","collapsedArray","collapsed","includes","id","hasSubmitted","errorCount","setErrorCount","fieldHasErrors","classNames","filter","Boolean","join","onFormChange","fullFieldsWithValues","newFormData","blockType","removeUndefinedAndNullRecursively","obj","Object","keys","forEach","key","undefined","setTimeout","update","node","setFields","rowErrorCount","formField","values","valid","onCollapsedChange","changedCollapsed","newCollapsed","length","push","splice","indexOf","hello","removeBlock","remove","Fragment","className","collapsibleStyle","header","div","pillStyle","singular","readOnly","count","withMessage","isEditable","buttonStyle","disabled","icon","onClick","e","preventDefault","round","tooltip","onToggle","incomingCollapsedState","fieldMap","Array","isArray","forceRender","margins","onChange"],"mappings":"AAGA,OAAOA,kCAAkC,2CAA0C;AACnF,MAAM,EAAEC,yBAAyB,EAAE,GAAGD;AACtC,SAASE,cAAc,QAAQ,2BAA0B;AACzD,OAAOC,iBAAiB,aAAY;AACpC,OAAOC,mBAAmB,UAAS;AACnC,MAAM,EAAEC,aAAa,EAAE,GAAGD;AAK1B,SAASE,MAAM,QAAQ,iCAAgC;AACvD,SAASC,WAAW,QAAQ,sCAAqC;AACjE,SAASC,SA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,OAAOqE;YAC/CzC,gCAAkB,oBAACzC;YAAUmF,OAAO5C;YAAYlB,MAAMA;YAAM+D,aAAAA;aAE9D9D,OAAO+D,UAAU,oBAChB,oBAACvF;YACCwF,aAAY;YACZV,WAAW,CAAC,EAAEhE,UAAU,cAAc,CAAC;YACvC2E,UAAU1E,OAAOqE;YACjBM,MAAK;YACLC,SAAS,CAACC;gBACRA,EAAEC,cAAc;gBAChBlB;YACF;YACAmB,OAAAA;YACAC,SAAQ;;QAKhBpE,aAAaA;QACb8B,KAAK;QACLuC,UAAU,CAACC;YACT9B,kBAAkB8B;YAClBrE,eAAeqE;QACjB;qBAEA,oBAAC3F;QACCwE,WAAW,CAAC,EAAEhE,UAAU,QAAQ,CAAC;QACjCoF,UAAUC,MAAMC,OAAO,CAACnF,cAAcA,aAAa,EAAE;QACrDoF,aAAAA;QACAC,SAAQ;QACRnF,MAAK,GAAG,wQAAwQ;;QAChRiE,UAAU;QACV9D,YAAYA;uBAIhB,oBAACX;QAAe4F,UAAUvD;;AAGhC,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/features/blocks/component/BlockContent.tsx"],"sourcesContent":["import type { FormState } from 'payload/types'\nimport type { Data } from 'payload/types'\n\nimport lexicalComposerContextImport from '@lexical/react/LexicalComposerContext.js'\nconst { useLexicalComposerContext } = lexicalComposerContextImport\nimport { getTranslation } from '@payloadcms/translations'\nimport isDeepEqual from 'deep-equal'\nimport lexicalImport from 'lexical'\nconst { $getNodeByKey } = lexicalImport\nimport type { FormFieldBase } from '@payloadcms/ui/fields/shared'\nimport type { FieldMap, ReducedBlock } from '@payloadcms/ui/utilities/buildComponentMap'\nimport type { CollapsedPreferences } from 'payload/types'\n\nimport { Button } from '@payloadcms/ui/elements/Button'\nimport { Collapsible } from '@payloadcms/ui/elements/Collapsible'\nimport { ErrorPill } from '@payloadcms/ui/elements/ErrorPill'\nimport { Pill } from '@payloadcms/ui/elements/Pill'\nimport { SectionTitle } from '@payloadcms/ui/fields/Blocks/SectionTitle'\nimport { useFormSubmitted } from '@payloadcms/ui/forms/Form'\nimport { RenderFields } from '@payloadcms/ui/forms/RenderFields'\nimport { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport React, { useCallback } from 'react'\n\nimport type { SanitizedClientEditorConfig } from '../../../lexical/config/types.js'\nimport type { BlockFields, BlockNode } from '../nodes/BlocksNode.js'\n\nimport { FormSavePlugin } from './FormSavePlugin.js'\n\ntype Props = {\n baseClass: string\n field: FormFieldBase & {\n editorConfig: SanitizedClientEditorConfig // With rendered features n stuff\n name: string\n richTextComponentMap: Map<string, React.ReactNode>\n }\n formData: BlockFields\n formSchema: FieldMap\n nodeKey: string\n path: string\n reducedBlock: ReducedBlock\n schemaPath: string\n}\n\n/**\n * The actual content of the Block. This should be INSIDE a Form component,\n * scoped to the block. All format operations in here are thus scoped to the block's form, and\n * not the whole document.\n */\nexport const BlockContent: React.FC<Props> = (props) => {\n const {\n baseClass,\n field,\n formData,\n formSchema,\n nodeKey,\n path,\n reducedBlock: { labels },\n schemaPath,\n } = props\n\n const { i18n } = useTranslation()\n const [editor] = useLexicalComposerContext()\n // Used for saving collapsed to preferences (and gettin' it from there again)\n // Remember, these preferences are scoped to the whole document, not just this form. This\n // is important to consider for the data path used in setDocFieldPreferences\n const { getDocPreferences, setDocFieldPreferences } = useDocumentInfo()\n\n const [isCollapsed, setIsCollapsed] = React.useState<boolean>(() => {\n let initialState = false\n\n void getDocPreferences().then((currentDocPreferences) => {\n const currentFieldPreferences = currentDocPreferences?.fields[field.name]\n\n const collapsedArray = currentFieldPreferences?.collapsed\n\n if (collapsedArray && collapsedArray.includes(formData.id)) {\n initialState = true\n setIsCollapsed(true)\n }\n })\n return initialState\n })\n\n const hasSubmitted = useFormSubmitted()\n\n const [errorCount, setErrorCount] = React.useState(0)\n\n const fieldHasErrors = hasSubmitted && errorCount > 0\n\n const classNames = [\n `${baseClass}__row`,\n fieldHasErrors ? `${baseClass}__row--has-errors` : `${baseClass}__row--no-errors`,\n ]\n .filter(Boolean)\n .join(' ')\n\n const onFormChange = useCallback(\n ({\n fullFieldsWithValues,\n newFormData,\n }: {\n fullFieldsWithValues: FormState\n newFormData: Data\n }) => {\n newFormData = {\n ...newFormData,\n id: formData.id,\n blockType: formData.blockType,\n }\n\n // Recursively remove all undefined values from even being present in formData, as they will\n // cause isDeepEqual to return false if, for example, formData has a key that fields.data\n // does not have, even if it's undefined.\n // Currently, this happens if a block has another sub-blocks field. Inside formData, that sub-blocks field has an undefined blockName property.\n // Inside of fields.data however, that sub-blocks blockName property does not exist at all.\n function removeUndefinedAndNullRecursively(obj: object) {\n Object.keys(obj).forEach((key) => {\n if (obj[key] && typeof obj[key] === 'object') {\n removeUndefinedAndNullRecursively(obj[key])\n } else if (obj[key] === undefined || obj[key] === null) {\n delete obj[key]\n }\n })\n }\n removeUndefinedAndNullRecursively(newFormData)\n removeUndefinedAndNullRecursively(formData)\n\n // Only update if the data has actually changed. Otherwise, we may be triggering an unnecessary value change,\n // which would trigger the \"Leave without saving\" dialog unnecessarily\n if (!isDeepEqual(formData, newFormData)) {\n // Running this in the next tick in the meantime fixes this issue: https://github.com/payloadcms/payload/issues/4108\n // I don't know why. When this is called immediately, it might focus out of a nested lexical editor field if an update is made there.\n // My hypothesis is that the nested editor might not have fully finished its update cycle yet. By updating in the next tick, we\n // ensure that the nested editor has finished its update cycle before we update the block node.\n setTimeout(() => {\n editor.update(() => {\n const node: BlockNode = $getNodeByKey(nodeKey)\n if (node) {\n node.setFields(newFormData as BlockFields)\n }\n })\n }, 0)\n }\n\n // update error count\n if (hasSubmitted) {\n let rowErrorCount = 0\n for (const formField of Object.values(fullFieldsWithValues)) {\n if (formField?.valid === false) {\n rowErrorCount++\n }\n }\n setErrorCount(rowErrorCount)\n }\n },\n [editor, nodeKey, hasSubmitted, formData],\n )\n\n const onCollapsedChange = useCallback(\n (changedCollapsed: boolean) => {\n void getDocPreferences().then((currentDocPreferences) => {\n const currentFieldPreferences = currentDocPreferences?.fields[field.name]\n\n const collapsedArray = currentFieldPreferences?.collapsed\n\n const newCollapsed: CollapsedPreferences =\n collapsedArray && collapsedArray?.length ? collapsedArray : []\n\n if (changedCollapsed) {\n if (!newCollapsed.includes(formData.id)) {\n newCollapsed.push(formData.id)\n }\n } else {\n if (newCollapsed.includes(formData.id)) {\n newCollapsed.splice(newCollapsed.indexOf(formData.id), 1)\n }\n }\n\n setDocFieldPreferences(field.name, {\n collapsed: newCollapsed,\n hello: 'hi',\n })\n })\n },\n [getDocPreferences, field.name, setDocFieldPreferences, formData.id],\n )\n\n const removeBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey).remove()\n })\n }, [editor, nodeKey])\n\n return (\n <React.Fragment>\n <Collapsible\n className={classNames}\n collapsibleStyle={fieldHasErrors ? 'error' : 'default'}\n header={\n <div className={`${baseClass}__block-header`}>\n <div>\n <Pill\n className={`${baseClass}__block-pill ${baseClass}__block-pill-${formData?.blockType}`}\n pillStyle=\"white\"\n >\n {typeof labels.singular === 'string'\n ? getTranslation(labels.singular, i18n)\n : '[Singular Label]'}\n </Pill>\n <SectionTitle path=\"blockName\" readOnly={field?.readOnly} />\n {fieldHasErrors && <ErrorPill count={errorCount} i18n={i18n} withMessage />}\n </div>\n {editor.isEditable() && (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={field?.readOnly}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeBlock()\n }}\n round\n tooltip=\"Remove Block\"\n />\n )}\n </div>\n }\n isCollapsed={isCollapsed}\n key={0}\n onToggle={(incomingCollapsedState) => {\n onCollapsedChange(incomingCollapsedState)\n setIsCollapsed(incomingCollapsedState)\n }}\n >\n <RenderFields\n className={`${baseClass}__fields`}\n fieldMap={Array.isArray(formSchema) ? formSchema : []}\n forceRender\n margins=\"small\"\n path=\"\" // Leaving path empty makes it so field values are not prefixed / scoped by the entire schemaPath. e.g. we can access \"myField\" instead of \"someLexicalField.feature.blocks.someArrayB\" // TODO: Could there be any implications leaving path different than schemaPath?\n readOnly={false}\n schemaPath={schemaPath} // Having the correct schemaPath here allows sub-fields (like array > addRow) to run correct form-state calls and retrieve their needed form state from the server\n />\n </Collapsible>\n\n <FormSavePlugin onChange={onFormChange} />\n </React.Fragment>\n )\n}\n"],"names":["lexicalComposerContextImport","useLexicalComposerContext","getTranslation","isDeepEqual","lexicalImport","$getNodeByKey","Button","Collapsible","ErrorPill","Pill","SectionTitle","useFormSubmitted","RenderFields","useDocumentInfo","useTranslation","React","useCallback","FormSavePlugin","BlockContent","props","baseClass","field","formData","formSchema","nodeKey","path","reducedBlock","labels","schemaPath","i18n","editor","getDocPreferences","setDocFieldPreferences","isCollapsed","setIsCollapsed","useState","initialState","then","currentDocPreferences","currentFieldPreferences","fields","name","collapsedArray","collapsed","includes","id","hasSubmitted","errorCount","setErrorCount","fieldHasErrors","classNames","filter","Boolean","join","onFormChange","fullFieldsWithValues","newFormData","blockType","removeUndefinedAndNullRecursively","obj","Object","keys","forEach","key","undefined","setTimeout","update","node","setFields","rowErrorCount","formField","values","valid","onCollapsedChange","changedCollapsed","newCollapsed","length","push","splice","indexOf","hello","removeBlock","remove","Fragment","className","collapsibleStyle","header","div","pillStyle","singular","readOnly","count","withMessage","isEditable","buttonStyle","disabled","icon","onClick","e","preventDefault","round","tooltip","onToggle","incomingCollapsedState","fieldMap","Array","isArray","forceRender","margins","onChange"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,OAAOA,kCAAkC,2CAA0C;AACnF,MAAM,EAAEC,yBAAyB,EAAE,GAAGD;AACtC,SAAS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E,UAAU,aAAa,EAAEA,UAAU,aAAa,EAAEE,UAAUmC,UAAU,CAAC;YACrF+B,WAAU;WAET,OAAO7D,OAAO8D,QAAQ,KAAK,WACxBvF,eAAeyB,OAAO8D,QAAQ,EAAE5D,QAChC,mCAEN,oBAACnB;YAAae,MAAK;YAAYiE,UAAUrE,OAAOqE;YAC/CzC,gCAAkB,oBAACzC;YAAUmF,OAAO5C;YAAYlB,MAAMA;YAAM+D,aAAAA;aAE9D9D,OAAO+D,UAAU,oBAChB,oBAACvF;YACCwF,aAAY;YACZV,WAAW,CAAC,EAAEhE,UAAU,cAAc,CAAC;YACvC2E,UAAU1E,OAAOqE;YACjBM,MAAK;YACLC,SAAS,CAACC;gBACRA,EAAEC,cAAc;gBAChBlB;YACF;YACAmB,OAAAA;YACAC,SAAQ;;QAKhBpE,aAAaA;QACb8B,KAAK;QACLuC,UAAU,CAACC;YACT9B,kBAAkB8B;YAClBrE,eAAeqE;QACjB;qBAEA,oBAAC3F;QACCwE,WAAW,CAAC,EAAEhE,UAAU,QAAQ,CAAC;QACjCoF,UAAUC,MAAMC,OAAO,CAACnF,cAAcA,aAAa,EAAE;QACrDoF,aAAAA;QACAC,SAAQ;QACRnF,MAAK,GAAG,wQAAwQ;;QAChRiE,UAAU;QACV9D,YAAYA;uBAIhB,oBAACX;QAAe4F,UAAUvD;;AAGhC,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/features/blocks/component/FormSavePlugin.tsx"],"sourcesContent":["import type { FormState } from 'payload/types'\nimport type { Data } from 'payload/types'\nimport type React from 'react'\n\nimport { useAllFormFields } from '@payloadcms/ui/forms/Form'\nimport { reduceFieldsToValues } from '@payloadcms/ui/utilities/reduceFieldsToValues'\nimport { useEffect } from 'react'\n\nimport { removeEmptyArrayValues } from './removeEmptyArrayValues.js'\n\ntype Props = {\n onChange?: ({\n fullFieldsWithValues,\n newFormData,\n }: {\n fullFieldsWithValues: FormState\n newFormData: Data\n }) => void\n}\n\nexport const FormSavePlugin: React.FC<Props> = (props) => {\n const { onChange } = props\n\n const [_fields] = useAllFormFields()\n\n const fields = removeEmptyArrayValues({ fields: _fields })\n\n // Pass in fields, and indicate if you'd like to \"unflatten\" field data.\n // The result below will reflect the data stored in the form at the given time\n const newFormData = reduceFieldsToValues(fields, true)\n\n useEffect(() => {\n if (onChange) {\n onChange({ fullFieldsWithValues: fields, newFormData })\n }\n }, [newFormData, onChange, fields])\n\n return null\n}\n"],"names":["useAllFormFields","reduceFieldsToValues","useEffect","removeEmptyArrayValues","FormSavePlugin","props","onChange","_fields","fields","newFormData","fullFieldsWithValues"],"mappings":"AAIA,SAASA,gBAAgB,QAAQ,4BAA2B;AAC5D,SAASC,oBAAoB,QAAQ,gDAA+C;AACpF,SAASC,SAAS,QAAQ,QAAO;AAEjC,SAASC,sBAAsB,QAAQ,8BAA6B;AAYpE,OAAO,MAAMC,iBAAkC,CAACC;IAC9C,MAAM,EAAEC,QAAQ,EAAE,GAAGD;IAErB,MAAM,CAACE,QAAQ,GAAGP;IAElB,MAAMQ,SAASL,uBAAuB;QAAEK,QAAQD;IAAQ;IAExD,wEAAwE;IACxE,8EAA8E;IAC9E,MAAME,cAAcR,qBAAqBO,QAAQ;IAEjDN,UAAU;QACR,IAAII,UAAU;YACZA,SAAS;gBAAEI,sBAAsBF;gBAAQC;YAAY;QACvD;IACF,GAAG;QAACA;QAAaH;QAAUE;KAAO;IAElC,OAAO;AACT,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/features/blocks/component/FormSavePlugin.tsx"],"sourcesContent":["import type { FormState } from 'payload/types'\nimport type { Data } from 'payload/types'\nimport type React from 'react'\n\nimport { useAllFormFields } from '@payloadcms/ui/forms/Form'\nimport { reduceFieldsToValues } from '@payloadcms/ui/utilities/reduceFieldsToValues'\nimport { useEffect } from 'react'\n\nimport { removeEmptyArrayValues } from './removeEmptyArrayValues.js'\n\ntype Props = {\n onChange?: ({\n fullFieldsWithValues,\n newFormData,\n }: {\n fullFieldsWithValues: FormState\n newFormData: Data\n }) => void\n}\n\nexport const FormSavePlugin: React.FC<Props> = (props) => {\n const { onChange } = props\n\n const [_fields] = useAllFormFields()\n\n const fields = removeEmptyArrayValues({ fields: _fields })\n\n // Pass in fields, and indicate if you'd like to \"unflatten\" field data.\n // The result below will reflect the data stored in the form at the given time\n const newFormData = reduceFieldsToValues(fields, true)\n\n useEffect(() => {\n if (onChange) {\n onChange({ fullFieldsWithValues: fields, newFormData })\n }\n }, [newFormData, onChange, fields])\n\n return null\n}\n"],"names":["useAllFormFields","reduceFieldsToValues","useEffect","removeEmptyArrayValues","FormSavePlugin","props","onChange","_fields","fields","newFormData","fullFieldsWithValues"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAIA,SAASA,gBAAgB,QAAQ,4BAA2B;AAC5D,SAASC,oBAAoB,QAAQ,gDAA+C;AACpF,SAASC,SAAS,QAAQ,QAAO;AAEjC,SAASC,sBAAsB,QAAQ,8BAA6B;AAYpE,OAAO,MAAMC,iBAAkC,CAACC;IAC9C,MAAM,EAAEC,QAAQ,EAAE,GAAGD;IAErB,MAAM,CAACE,QAAQ,GAAGP;IAElB,MAAMQ,SAASL,uBAAuB;QAAEK,QAAQD;IAAQ;IAExD,wEAAwE;IACxE,8EAA8E;IAC9E,MAAME,cAAcR,qBAAqBO,QAAQ;IAEjDN,UAAU;QACR,IAAII,UAAU;YACZA,SAAS;gBAAEI,sBAAsBF;gBAAQC;YAAY;QACvD;IACF,GAAG;QAACA;QAAaH;QAAUE;KAAO;IAElC,OAAO;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/features/blocks/component/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FormProps } from '@payloadcms/ui/forms/Form'\n\nimport { Form } from '@payloadcms/ui/forms/Form'\nimport React, { useCallback, useEffect, useMemo, useState } from 'react'\n\nimport { type BlockFields } from '../nodes/BlocksNode.js'\nconst baseClass = 'lexical-block'\n\nimport type { ReducedBlock } from '@payloadcms/ui/utilities/buildComponentMap'\nimport type { FormState } from 'payload/types'\n\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport { useFormSubmitted } from '@payloadcms/ui/forms/Form'\nimport { useConfig } from '@payloadcms/ui/providers/Config'\nimport { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo'\nimport { getFormState } from '@payloadcms/ui/utilities/getFormState'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ClientComponentProps } from '../../types.js'\nimport type { BlocksFeatureClientProps } from '../feature.client.js'\n\nimport { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js'\nimport { BlockContent } from './BlockContent.js'\nimport './index.scss'\nimport { removeEmptyArrayValues } from './removeEmptyArrayValues.js'\n\ntype Props = {\n blockFieldWrapperName: string\n children?: React.ReactNode\n\n formData: BlockFields\n nodeKey?: string\n /**\n * This transformedFormData already comes wrapped in blockFieldWrapperName\n */\n transformedFormData: BlockFields\n}\n\nexport const BlockComponent: React.FC<Props> = (props) => {\n const { blockFieldWrapperName, formData, nodeKey } = props\n const config = useConfig()\n const submitted = useFormSubmitted()\n const { id } = useDocumentInfo()\n const { path, schemaPath } = useFieldProps()\n const { editorConfig, field: parentLexicalRichTextField } = useEditorConfigContext()\n\n const [initialState, setInitialState] = useState<FormState | false>(false)\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n\n const componentMapRenderedFieldsPath = `feature.blocks.fields.${formData?.blockType}`\n const schemaFieldsPath = `${schemaPath}.feature.blocks.${formData?.blockType}`\n\n const reducedBlock: ReducedBlock = (\n editorConfig?.resolvedFeatureMap?.get('blocks')\n ?.clientFeatureProps as ClientComponentProps<BlocksFeatureClientProps>\n )?.reducedBlocks?.find((block) => block.slug === formData?.blockType)\n\n const fieldMap = richTextComponentMap.get(componentMapRenderedFieldsPath)\n // Field Schema\n useEffect(() => {\n const awaitInitialState = async () => {\n const state = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n data: JSON.parse(JSON.stringify(formData)),\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n }) // Form State\n\n if (state) {\n setInitialState({\n ...removeEmptyArrayValues({ fields: state }),\n blockName: {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n })\n }\n }\n\n if (formData) {\n void awaitInitialState()\n }\n }, [config.routes.api, config.serverURL, schemaFieldsPath, id])\n\n const onChange: FormProps['onChange'][0] = useCallback(\n async ({ formState: prevFormState }) => {\n const formState = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n formState: prevFormState,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n })\n\n return {\n ...formState,\n blockName: {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n }\n },\n\n [config.routes.api, config.serverURL, schemaFieldsPath, id, formData.blockName],\n )\n\n // Memoized Form JSX\n const formContent = useMemo(() => {\n return (\n reducedBlock &&\n initialState !== false && (\n <Form\n // @ts-expect-error TODO: Fix this\n fields={fieldMap}\n initialState={initialState}\n onChange={[onChange]}\n submitted={submitted}\n uuid={uuid()}\n >\n <BlockContent\n baseClass={baseClass}\n field={parentLexicalRichTextField}\n formData={formData}\n formSchema={Array.isArray(fieldMap) ? fieldMap : []}\n nodeKey={nodeKey}\n path={`${path}.feature.blocks.${formData.blockType}`}\n reducedBlock={reducedBlock}\n schemaPath={schemaFieldsPath}\n />\n </Form>\n )\n )\n }, [\n fieldMap,\n parentLexicalRichTextField,\n nodeKey,\n submitted,\n initialState,\n reducedBlock,\n blockFieldWrapperName,\n onChange,\n ])\n\n return <div className={baseClass}>{formContent}</div>\n}\n"],"names":["Form","React","useCallback","useEffect","useMemo","useState","baseClass","useFieldProps","useFormSubmitted","useConfig","useDocumentInfo","getFormState","v4","uuid","useEditorConfigContext","BlockContent","removeEmptyArrayValues","BlockComponent","props","blockFieldWrapperName","formData","nodeKey","config","submitted","id","path","schemaPath","editorConfig","field","parentLexicalRichTextField","initialState","setInitialState","richTextComponentMap","componentMapRenderedFieldsPath","blockType","schemaFieldsPath","reducedBlock","resolvedFeatureMap","get","clientFeatureProps","reducedBlocks","find","block","slug","fieldMap","awaitInitialState","state","apiRoute","routes","api","body","data","JSON","parse","stringify","operation","serverURL","fields","blockName","initialValue","passesCondition","valid","value","onChange","formState","prevFormState","formContent","formSchema","Array","isArray","div","className"],"mappings":"AAAA;AAIA,SAASA,IAAI,QAAQ,4BAA2B;AAChD,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AAGxE,MAAMC,YAAY;AAKlB,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,gBAAgB,QAAQ,4BAA2B;AAC5D,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,eAAe,QAAQ,wCAAuC;AACvE,SAASC,YAAY,QAAQ,wCAAuC;AACpE,SAASC,MAAMC,IAAI,QAAQ,OAAM;AAKjC,SAASC,sBAAsB,QAAQ,yDAAwD;AAC/F,SAASC,YAAY,QAAQ,oBAAmB;AAChD,OAAO,eAAc;AACrB,SAASC,sBAAsB,QAAQ,8BAA6B;AAcpE,OAAO,MAAMC,iBAAkC,CAACC;IAC9C,MAAM,EAAEC,qBAAqB,EAAEC,QAAQ,EAAEC,OAAO,EAAE,GAAGH;IACrD,MAAMI,SAASb;IACf,MAAMc,YAAYf;IAClB,MAAM,EAAEgB,EAAE,EAAE,GAAGd;IACf,MAAM,EAAEe,IAAI,EAAEC,UAAU,EAAE,GAAGnB;IAC7B,MAAM,EAAEoB,YAAY,EAAEC,OAAOC,0BAA0B,EAAE,GAAGf;IAE5D,MAAM,CAACgB,cAAcC,gBAAgB,GAAG1B,SAA4B;IACpE,MAAM,EACJuB,OAAO,EAAEI,oBAAoB,EAAE,EAChC,GAAGlB;IAEJ,MAAMmB,iCAAiC,CAAC,sBAAs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OAAO1C,SAASsC,SAAS;YAC3B;QACF;IACF,GAEA;QAACpC,OAAO0B,MAAM,CAACC,GAAG;QAAE3B,OAAOkC,SAAS;QAAErB;QAAkBX;QAAIJ,SAASsC,SAAS;KAAC;IAGjF,oBAAoB;IACpB,MAAMQ,cAAc9D,QAAQ;QAC1B,OACEgC,gBACAN,iBAAiB,uBACf,oBAAC9B;YACC,kCAAkC;YAClCyD,QAAQb;YACRd,cAAcA;YACdiC,UAAU;gBAACA;aAAS;YACpBxC,WAAWA;YACXV,MAAMA;yBAEN,oBAACE;YACCT,WAAWA;YACXsB,OAAOC;YACPT,UAAUA;YACV+C,YAAYC,MAAMC,OAAO,CAACzB,YAAYA,WAAW,EAAE;YACnDvB,SAASA;YACTI,MAAM,CAAC,EAAEA,KAAK,gBAAgB,EAAEL,SAASc,SAAS,CAAC,CAAC;YACpDE,cAAcA;YACdV,YAAYS;;IAKtB,GAAG;QACDS;QACAf;QACAR;QACAE;QACAO;QACAM;QACAjB;QACA4C;KACD;IAED,qBAAO,oBAACO;QAAIC,WAAWjE;OAAY4D;AACrC,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/features/blocks/component/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FormProps } from '@payloadcms/ui/forms/Form'\n\nimport { Form } from '@payloadcms/ui/forms/Form'\nimport React, { useCallback, useEffect, useMemo, useState } from 'react'\n\nimport { type BlockFields } from '../nodes/BlocksNode.js'\nconst baseClass = 'lexical-block'\n\nimport type { ReducedBlock } from '@payloadcms/ui/utilities/buildComponentMap'\nimport type { FormState } from 'payload/types'\n\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport { useFormSubmitted } from '@payloadcms/ui/forms/Form'\nimport { useConfig } from '@payloadcms/ui/providers/Config'\nimport { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo'\nimport { getFormState } from '@payloadcms/ui/utilities/getFormState'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ClientComponentProps } from '../../types.js'\nimport type { BlocksFeatureClientProps } from '../feature.client.js'\n\nimport { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js'\nimport { BlockContent } from './BlockContent.js'\nimport './index.scss'\nimport { removeEmptyArrayValues } from './removeEmptyArrayValues.js'\n\ntype Props = {\n blockFieldWrapperName: string\n children?: React.ReactNode\n\n formData: BlockFields\n nodeKey?: string\n /**\n * This transformedFormData already comes wrapped in blockFieldWrapperName\n */\n transformedFormData: BlockFields\n}\n\nexport const BlockComponent: React.FC<Props> = (props) => {\n const { blockFieldWrapperName, formData, nodeKey } = props\n const config = useConfig()\n const submitted = useFormSubmitted()\n const { id } = useDocumentInfo()\n const { path, schemaPath } = useFieldProps()\n const { editorConfig, field: parentLexicalRichTextField } = useEditorConfigContext()\n\n const [initialState, setInitialState] = useState<FormState | false>(false)\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n\n const componentMapRenderedFieldsPath = `feature.blocks.fields.${formData?.blockType}`\n const schemaFieldsPath = `${schemaPath}.feature.blocks.${formData?.blockType}`\n\n const reducedBlock: ReducedBlock = (\n editorConfig?.resolvedFeatureMap?.get('blocks')\n ?.clientFeatureProps as ClientComponentProps<BlocksFeatureClientProps>\n )?.reducedBlocks?.find((block) => block.slug === formData?.blockType)\n\n const fieldMap = richTextComponentMap.get(componentMapRenderedFieldsPath)\n // Field Schema\n useEffect(() => {\n const awaitInitialState = async () => {\n const state = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n data: JSON.parse(JSON.stringify(formData)),\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n }) // Form State\n\n if (state) {\n setInitialState({\n ...removeEmptyArrayValues({ fields: state }),\n blockName: {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n })\n }\n }\n\n if (formData) {\n void awaitInitialState()\n }\n }, [config.routes.api, config.serverURL, schemaFieldsPath, id])\n\n const onChange: FormProps['onChange'][0] = useCallback(\n async ({ formState: prevFormState }) => {\n const formState = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n formState: prevFormState,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n })\n\n return {\n ...formState,\n blockName: {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n }\n },\n\n [config.routes.api, config.serverURL, schemaFieldsPath, id, formData.blockName],\n )\n\n // Memoized Form JSX\n const formContent = useMemo(() => {\n return (\n reducedBlock &&\n initialState !== false && (\n <Form\n // @ts-expect-error TODO: Fix this\n fields={fieldMap}\n initialState={initialState}\n onChange={[onChange]}\n submitted={submitted}\n uuid={uuid()}\n >\n <BlockContent\n baseClass={baseClass}\n field={parentLexicalRichTextField}\n formData={formData}\n formSchema={Array.isArray(fieldMap) ? fieldMap : []}\n nodeKey={nodeKey}\n path={`${path}.feature.blocks.${formData.blockType}`}\n reducedBlock={reducedBlock}\n schemaPath={schemaFieldsPath}\n />\n </Form>\n )\n )\n }, [\n fieldMap,\n parentLexicalRichTextField,\n nodeKey,\n submitted,\n initialState,\n reducedBlock,\n blockFieldWrapperName,\n onChange,\n ])\n\n return <div className={baseClass}>{formContent}</div>\n}\n"],"names":["Form","React","useCallback","useEffect","useMemo","useState","baseClass","useFieldProps","useFormSubmitted","useConfig","useDocumentInfo","getFormState","v4","uuid","useEditorConfigContext","BlockContent","removeEmptyArrayValues","BlockComponent","props","blockFieldWrapperName","formData","nodeKey","config","submitted","id","path","schemaPath","editorConfig","field","parentLexicalRichTextField","initialState","setInitialState","richTextComponentMap","componentMapRenderedFieldsPath","blockType","schemaFieldsPath","reducedBlock","resolvedFeatureMap","get","clientFeatureProps","reducedBlocks","find","block","slug","fieldMap","awaitInitialState","state","apiRoute","routes","api","body","data","JSON","parse","stringify","operation","serverURL","fields","blockName","initialValue","passesCondition","valid","value","onChange","formState","prevFormState","formContent","formSchema","Array","isArray","div","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAQ;QAC1B,OACEgC,gBACAN,iBAAiB,uBACf,oBAAC9B;YACC,kCAAkC;YAClCyD,QAAQb;YACRd,cAAcA;YACdiC,UAAU;gBAACA;aAAS;YACpBxC,WAAWA;YACXV,MAAMA;yBAEN,oBAACE;YACCT,WAAWA;YACXsB,OAAOC;YACPT,UAAUA;YACV+C,YAAYC,MAAMC,OAAO,CAACzB,YAAYA,WAAW,EAAE;YACnDvB,SAASA;YACTI,MAAM,CAAC,EAAEA,KAAK,gBAAgB,EAAEL,SAASc,SAAS,CAAC,CAAC;YACpDE,cAAcA;YACdV,YAAYS;;IAKtB,GAAG;QACDS;QACAf;QACAR;QACAE;QACAO;QACAM;QACAjB;QACA4C;KACD;IAED,qBAAO,oBAACO;QAAIC,WAAWjE;OAAY4D;AACrC,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/features/blocks/component/removeEmptyArrayValues.ts"],"sourcesContent":["import type { FormState } from 'payload/types'\n\n/**\n * By default, if an array field is empty, it will be included in the form state with a value of 0.\n * We do not need this behavior here, By setting `disableFormData` to true, we can prevent the field from being included in the form state\n * like that.\n * @param fields form state\n */\nexport function removeEmptyArrayValues({ fields }: { fields: FormState }): FormState {\n for (const key in fields) {\n const field = fields[key]\n if (Array.isArray(field.rows) && 'value' in field) {\n field.disableFormData = true\n }\n }\n return fields\n}\n"],"names":["removeEmptyArrayValues","fields","key","field","Array","isArray","rows","disableFormData"],"mappings":"AAEA;;;;;CAKC,GACD,OAAO,SAASA,uBAAuB,EAAEC,MAAM,EAAyB;IACtE,IAAK,MAAMC,OAAOD,OAAQ;QACxB,MAAME,QAAQF,MAAM,CAACC,IAAI;QACzB,IAAIE,MAAMC,OAAO,CAACF,MAAMG,IAAI,KAAK,WAAWH,OAAO;YACjDA,MAAMI,eAAe,GAAG;QAC1B;IACF;IACA,OAAON;AACT"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/features/blocks/component/removeEmptyArrayValues.ts"],"sourcesContent":["import type { FormState } from 'payload/types'\n\n/**\n * By default, if an array field is empty, it will be included in the form state with a value of 0.\n * We do not need this behavior here, By setting `disableFormData` to true, we can prevent the field from being included in the form state\n * like that.\n * @param fields form state\n */\nexport function removeEmptyArrayValues({ fields }: { fields: FormState }): FormState {\n for (const key in fields) {\n const field = fields[key]\n if (Array.isArray(field.rows) && 'value' in field) {\n field.disableFormData = true\n }\n }\n return fields\n}\n"],"names":["removeEmptyArrayValues","fields","key","field","Array","isArray","rows","disableFormData"],"rangeMappings":";;;;;;;;;;;;;","mappings":"AAEA;;;;;CAKC,GACD,OAAO,SAASA,uBAAuB,EAAEC,MAAM,EAAyB;IACtE,IAAK,MAAMC,OAAOD,OAAQ;QACxB,MAAME,QAAQF,MAAM,CAACC,IAAI;QACzB,IAAIE,MAAMC,OAAO,CAACF,MAAMG,IAAI,KAAK,WAAWH,OAAO;YACjDA,MAAMI,eAAe,GAAG;QAC1B;IACF;IACA,OAAON;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/features/blocks/drawer/index.tsx"],"sourcesContent":["'use client'\nimport * as facelessUIImport from '@faceless-ui/modal'\nimport lexicalComposerContextImport from '@lexical/react/LexicalComposerContext.js'\nconst { useLexicalComposerContext } = lexicalComposerContextImport\nimport lexicalImport from 'lexical'\nconst { $getNodeByKey, COMMAND_PRIORITY_EDITOR, createCommand } = lexicalImport\n\nimport type { LexicalCommand, LexicalEditor } from 'lexical'\n\nimport { formatDrawerSlug } from '@payloadcms/ui/elements/Drawer'\nimport { BlocksDrawer } from '@payloadcms/ui/fields/Blocks/BlocksDrawer'\nimport { useEditDepth } from '@payloadcms/ui/providers/EditDepth'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport type { ClientComponentProps } from '../../types.js'\nimport type { BlocksFeatureClientProps } from '../feature.client.js'\n\nimport { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js'\nimport { $createBlockNode } from '../nodes/BlocksNode.js'\nimport { INSERT_BLOCK_COMMAND } from '../plugin/commands.js'\nconst baseClass = 'lexical-blocks-drawer'\n\nexport const INSERT_BLOCK_WITH_DRAWER_COMMAND: LexicalCommand<{\n replace: { nodeKey: string } | false\n}> = createCommand('INSERT_BLOCK_WITH_DRAWER_COMMAND')\n\nconst insertBlock = ({\n blockType,\n editor,\n replaceNodeKey,\n}: {\n blockType: string\n editor: LexicalEditor\n replaceNodeKey: null | string\n}) => {\n if (!replaceNodeKey) {\n editor.dispatchCommand(INSERT_BLOCK_COMMAND, {\n id: null,\n blockName: '',\n blockType,\n })\n } else {\n editor.update(() => {\n const node = $getNodeByKey(replaceNodeKey)\n if (node) {\n node.replace(\n $createBlockNode({\n id: null,\n blockName: '',\n blockType,\n }),\n )\n }\n })\n }\n}\n\nexport const BlocksDrawerComponent: React.FC = () => {\n const { useModal } = facelessUIImport\n\n const [editor] = useLexicalComposerContext()\n const { editorConfig, uuid } = useEditorConfigContext()\n\n const [replaceNodeKey, setReplaceNodeKey] = useState<null | string>(null)\n const editDepth = useEditDepth()\n const { t } = useTranslation()\n const { openModal } = useModal()\n\n const labels = {\n plural: t('fields:blocks') || 'Blocks',\n singular: t('fields:block') || 'Block',\n }\n\n const addRow = useCallback(\n (rowIndex: number, blockType: string) => {\n insertBlock({\n blockType,\n editor,\n replaceNodeKey,\n })\n },\n [editor, replaceNodeKey],\n )\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-rich-text-blocks-` + uuid,\n depth: editDepth,\n })\n\n const reducedBlocks = (\n editorConfig?.resolvedFeatureMap?.get('blocks')\n ?.clientFeatureProps as ClientComponentProps<BlocksFeatureClientProps>\n )?.reducedBlocks\n\n useEffect(() => {\n return editor.registerCommand<{\n replace: { nodeKey: string } | false\n }>(\n INSERT_BLOCK_WITH_DRAWER_COMMAND,\n (payload) => {\n setReplaceNodeKey(payload?.replace ? payload?.replace.nodeKey : null)\n openModal(drawerSlug)\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n )\n }, [editor, drawerSlug, openModal])\n\n return (\n <BlocksDrawer\n addRow={addRow}\n addRowIndex={0}\n blocks={reducedBlocks}\n drawerSlug={drawerSlug}\n labels={labels}\n />\n )\n}\n"],"names":["facelessUIImport","lexicalComposerContextImport","useLexicalComposerContext","lexicalImport","$getNodeByKey","COMMAND_PRIORITY_EDITOR","createCommand","formatDrawerSlug","BlocksDrawer","useEditDepth","useTranslation","React","useCallback","useEffect","useState","useEditorConfigContext","$createBlockNode","INSERT_BLOCK_COMMAND","baseClass","INSERT_BLOCK_WITH_DRAWER_COMMAND","insertBlock","blockType","editor","replaceNodeKey","dispatchCommand","id","blockName","update","node","replace","BlocksDrawerComponent","useModal","editorConfig","uuid","setReplaceNodeKey","editDepth","t","openModal","labels","plural","singular","addRow","rowIndex","drawerSlug","slug","depth","reducedBlocks","resolvedFeatureMap","get","clientFeatureProps","registerCommand","payload","nodeKey","addRowIndex","blocks"],"mappings":"AAAA;AACA,YAAYA,sBAAsB,qBAAoB;AACtD,OAAOC,kCAAkC,2CAA0C;AACnF,MAAM,EAAEC,yBAAyB,EAAE,GAAGD;AACtC,OAAOE,mBAAmB,UAAS;AACnC,MAAM,EAAEC,aAAa,EAAEC,uBAAuB,EAAEC,aAAa,EAAE,GAAGH;AAIlE,SAASI,gBAAgB,QAAQ,iCAAgC;AACjE,SAASC,YAAY,QAAQ,4CAA2C;AACxE,SAASC,YAAY,QAAQ,qCAAoC;AACjE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAK/D,SAASC,sBAAsB,QAAQ,yDAAwD;AAC/F,SAASC,gBAAgB,QAAQ,yBAAwB;AACzD,SAASC,oBAAoB,QAAQ,wBAAuB;AAC5D,MAAMC,YAAY;AAElB,OAAO,MAAMC,mCAERb,cAAc,oCAAmC;AAEtD,MAAMc,cAAc,CAAC,EACnB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AAQR;QACRH,YAAYA;QACZL,QAAQA;;AAGd,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/features/blocks/drawer/index.tsx"],"sourcesContent":["'use client'\nimport * as facelessUIImport from '@faceless-ui/modal'\nimport lexicalComposerContextImport from '@lexical/react/LexicalComposerContext.js'\nconst { useLexicalComposerContext } = lexicalComposerContextImport\nimport lexicalImport from 'lexical'\nconst { $getNodeByKey, COMMAND_PRIORITY_EDITOR, createCommand } = lexicalImport\n\nimport type { LexicalCommand, LexicalEditor } from 'lexical'\n\nimport { formatDrawerSlug } from '@payloadcms/ui/elements/Drawer'\nimport { BlocksDrawer } from '@payloadcms/ui/fields/Blocks/BlocksDrawer'\nimport { useEditDepth } from '@payloadcms/ui/providers/EditDepth'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport type { ClientComponentProps } from '../../types.js'\nimport type { BlocksFeatureClientProps } from '../feature.client.js'\n\nimport { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js'\nimport { $createBlockNode } from '../nodes/BlocksNode.js'\nimport { INSERT_BLOCK_COMMAND } from '../plugin/commands.js'\nconst baseClass = 'lexical-blocks-drawer'\n\nexport const INSERT_BLOCK_WITH_DRAWER_COMMAND: LexicalCommand<{\n replace: { nodeKey: string } | false\n}> = createCommand('INSERT_BLOCK_WITH_DRAWER_COMMAND')\n\nconst insertBlock = ({\n blockType,\n editor,\n replaceNodeKey,\n}: {\n blockType: string\n editor: LexicalEditor\n replaceNodeKey: null | string\n}) => {\n if (!replaceNodeKey) {\n editor.dispatchCommand(INSERT_BLOCK_COMMAND, {\n id: null,\n blockName: '',\n blockType,\n })\n } else {\n editor.update(() => {\n const node = $getNodeByKey(replaceNodeKey)\n if (node) {\n node.replace(\n $createBlockNode({\n id: null,\n blockName: '',\n blockType,\n }),\n )\n }\n })\n }\n}\n\nexport const BlocksDrawerComponent: React.FC = () => {\n const { useModal } = facelessUIImport\n\n const [editor] = useLexicalComposerContext()\n const { editorConfig, uuid } = useEditorConfigContext()\n\n const [replaceNodeKey, setReplaceNodeKey] = useState<null | string>(null)\n const editDepth = useEditDepth()\n const { t } = useTranslation()\n const { openModal } = useModal()\n\n const labels = {\n plural: t('fields:blocks') || 'Blocks',\n singular: t('fields:block') || 'Block',\n }\n\n const addRow = useCallback(\n (rowIndex: number, blockType: string) => {\n insertBlock({\n blockType,\n editor,\n replaceNodeKey,\n })\n },\n [editor, replaceNodeKey],\n )\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-rich-text-blocks-` + uuid,\n depth: editDepth,\n })\n\n const reducedBlocks = (\n editorConfig?.resolvedFeatureMap?.get('blocks')\n ?.clientFeatureProps as ClientComponentProps<BlocksFeatureClientProps>\n )?.reducedBlocks\n\n useEffect(() => {\n return editor.registerCommand<{\n replace: { nodeKey: string } | false\n }>(\n INSERT_BLOCK_WITH_DRAWER_COMMAND,\n (payload) => {\n setReplaceNodeKey(payload?.replace ? payload?.replace.nodeKey : null)\n openModal(drawerSlug)\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n )\n }, [editor, drawerSlug, openModal])\n\n return (\n <BlocksDrawer\n addRow={addRow}\n addRowIndex={0}\n blocks={reducedBlocks}\n drawerSlug={drawerSlug}\n labels={labels}\n />\n )\n}\n"],"names":["facelessUIImport","lexicalComposerContextImport","useLexicalComposerContext","lexicalImport","$getNodeByKey","COMMAND_PRIORITY_EDITOR","createCommand","formatDrawerSlug","BlocksDrawer","useEditDepth","useTranslation","React","useCallback","useEffect","useState","useEditorConfigContext","$createBlockNode","INSERT_BLOCK_COMMAND","baseClass","INSERT_BLOCK_WITH_DRAWER_COMMAND","insertBlock","blockType","editor","replaceNodeKey","dispatchCommand","id","blockName","update","node","replace","BlocksDrawerComponent","useModal","editorConfig","uuid","setReplaceNodeKey","editDepth","t","openModal","labels","plural","singular","addRow","rowIndex","drawerSlug","slug","depth","reducedBlocks","resolvedFeatureMap","get","clientFeatureProps","regist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IAE/B,MAAM,CAACQ,gBAAgBW,kBAAkB,GAAGpB,SAAwB;IACpE,MAAMqB,YAAY1B;IAClB,MAAM,EAAE2B,CAAC,EAAE,GAAG1B;IACd,MAAM,EAAE2B,SAAS,EAAE,GAAGN;IAEtB,MAAMO,SAAS;QACbC,QAAQH,EAAE,oBAAoB;QAC9BI,UAAUJ,EAAE,mBAAmB;IACjC;IAEA,MAAMK,SAAS7B,YACb,CAAC8B,UAAkBrB;QACjBD,YAAY;YACVC;YACAC;YACAC;QACF;IACF,GACA;QAACD;QAAQC;KAAe;IAG1B,MAAMoB,aAAapC,iBAAiB;QAClCqC,MAAM,CAAC,yBAAyB,CAAC,GAAGX;QACpCY,OAAOV;IACT;IAEA,MAAMW,gBACJd,cAAce,oBAAoBC,IAAI,WAClCC,oBACHH;IAEHjC,UAAU;QACR,OAAOS,OAAO4B,eAAe,CAG3B/B,kCACA,CAACgC;YACCjB,kBAAkBiB,SAAStB,UAAUsB,SAAStB,QAAQuB,UAAU;YAChEf,UAAUM;YACV,OAAO;QACT,GACAtC;IAEJ,GAAG;QAACiB;QAAQqB;QAAYN;KAAU;IAElC,qBACE,oBAAC7B;QACCiC,QAAQA;QACRY,aAAa;QACbC,QAAQR;QACRH,YAAYA;QACZL,QAAQA;;AAGd,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/field/features/blocks/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport type { ReducedBlock } from '@payloadcms/ui/utilities/buildComponentMap'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { SlashMenuOption } from '../../lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js'\nimport { BlockIcon } from '../../lexical/ui/icons/Block/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { BlockNode } from './nodes/BlocksNode.js'\nimport { INSERT_BLOCK_COMMAND } from './plugin/commands.js'\nimport { BlocksPlugin } from './plugin/index.js'\n\nexport type BlocksFeatureClientProps = {\n reducedBlocks: ReducedBlock[]\n}\n\nconst BlocksFeatureClient: FeatureProviderProviderClient<BlocksFeatureClientProps> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n nodes: [BlockNode],\n plugins: [\n {\n Component: BlocksPlugin,\n position: 'normal',\n },\n ],\n slashMenu: {\n options: [\n {\n displayName: 'Blocks',\n key: 'blocks',\n options: [\n ...props.reducedBlocks.map((block) => {\n return new SlashMenuOption('block-' + block.slug, {\n Icon: BlockIcon,\n displayName: ({ i18n }) => {\n if (!block.labels.singular) {\n return block.slug\n }\n\n return getTranslation(block.labels.singular, i18n)\n },\n keywords: ['block', 'blocks', block.slug],\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_BLOCK_COMMAND, {\n id: null,\n blockName: '',\n blockType: block.slug,\n })\n },\n })\n }),\n ],\n },\n ],\n },\n }),\n }\n}\n\nexport const BlocksFeatureClientComponent = createClientComponent(BlocksFeatureClient)\n"],"names":["getTranslation","SlashMenuOption","BlockIcon","createClientComponent","BlockNode","INSERT_BLOCK_COMMAND","BlocksPlugin","BlocksFeatureClient","props","clientFeatureProps","feature","nodes","plugins","Component","position","slashMenu","options","displayName","key","reducedBlocks","map","block","slug","Icon","i18n","labels","singular","keywords","onSelect","editor","dispatchCommand","id","blockName","blockType","BlocksFeatureClientComponent"],"mappings":"AAAA;AAIA,SAASA,cAAc,QAAQ,2BAA0B;AAIzD,SAASC,eAAe,QAAQ,sEAAqE;AACrG,SAASC,SAAS,QAAQ,wCAAuC;AACjE,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,SAAS,QAAQ,wBAAuB;AACjD,SAASC,oBAAoB,QAAQ,uBAAsB;AAC3D,SAASC,YAAY,QAAQ,oBAAmB;AAMhD,MAAMC,sBAA+E,CAACC;IACpF,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,OAAO;oBAACP;iBAAU;gBAClBQ,SAAS;oBACP;wBACEC,WAAWP;wBACXQ,UAAU;oBACZ;iBACD;gBACDC,WAAW;oBACTC,SAAS;wBACP;4BACEC,aAAa;4BACbC,KAAK;4BACLF,SAAS;mCACJR,MAAMW,aAAa,CAACC,GAAG,CAAC,CAACC;oCAC1B,OAAO,IAAIpB,gBAAgB,WAAWoB,MAAMC,IAAI,EAAE;wCAChDC,MAAMrB;wCACNe,aAAa,CAAC,EAAEO,IAAI,EAAE;4CACpB,IAAI,CAACH,MAAMI,MAAM,CAACC,QAAQ,EAAE;gDAC1B,OAAOL,MAAMC,IAAI;4CACnB;4CAEA,OAAOtB,eAAeqB,MAAMI,MAAM,CAACC,QAAQ,EAAEF;wCAC/C;wCACAG,UAAU;4CAAC;4CAAS;4CAAUN,MAAMC,IAAI;yCAAC;wCACzCM,UAAU,CAAC,EAAEC,MAAM,EAAE;4CACnBA,OAAOC,eAAe,CAACzB,sBAAsB;gDAC3C0B,IAAI;gDACJC,WAAW;gDACXC,WAAWZ,MAAMC,IAAI;4CACvB;wCACF;oCACF;gCACF;6BACD;wBACH;qBACD;gBACH;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAMY,+BAA+B/B,sBAAsBI,qBAAoB"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/features/blocks/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport type { ReducedBlock } from '@payloadcms/ui/utilities/buildComponentMap'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { SlashMenuOption } from '../../lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js'\nimport { BlockIcon } from '../../lexical/ui/icons/Block/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { BlockNode } from './nodes/BlocksNode.js'\nimport { INSERT_BLOCK_COMMAND } from './plugin/commands.js'\nimport { BlocksPlugin } from './plugin/index.js'\n\nexport type BlocksFeatureClientProps = {\n reducedBlocks: ReducedBlock[]\n}\n\nconst BlocksFeatureClient: FeatureProviderProviderClient<BlocksFeatureClientProps> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n nodes: [BlockNode],\n plugins: [\n {\n Component: BlocksPlugin,\n position: 'normal',\n },\n ],\n slashMenu: {\n options: [\n {\n displayName: 'Blocks',\n key: 'blocks',\n options: [\n ...props.reducedBlocks.map((block) => {\n return new SlashMenuOption('block-' + block.slug, {\n Icon: BlockIcon,\n displayName: ({ i18n }) => {\n if (!block.labels.singular) {\n return block.slug\n }\n\n return getTranslation(block.labels.singular, i18n)\n },\n keywords: ['block', 'blocks', block.slug],\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_BLOCK_COMMAND, {\n id: null,\n blockName: '',\n blockType: block.slug,\n })\n },\n })\n }),\n ],\n },\n ],\n },\n }),\n }\n}\n\nexport const BlocksFeatureClientComponent = createClientComponent(BlocksFeatureClient)\n"],"names":["getTranslation","SlashMenuOption","BlockIcon","createClientComponent","BlockNode","INSERT_BLOCK_COMMAND","BlocksPlugin","BlocksFeatureClient","props","clientFeatureProps","feature","nodes","plugins","Component","position","slashMenu","options","displayName","key","reducedBlocks","map","block","slug","Icon","i18n","labels","singular","keywords","onSelect","editor","dispatchCommand","id","blockName","blockType","BlocksFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,cAAc,QAAQ,2BAA0B;AAIzD,SAASC,eAAe,QAAQ,sEAAqE;AACrG,SAASC,SAAS,QAAQ,wCAAuC;AACjE,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,SAAS,QAAQ,wBAAuB;AACjD,SAASC,oBAAoB,QAAQ,uBAAsB;AAC3D,SAASC,YAAY,QAAQ,oBAAmB;AAMhD,MAAMC,sBAA+E,CAACC;IACpF,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,OAAO;oBAACP;iBAAU;gBAClBQ,SAAS;oBACP;wBACEC,WAAWP;wBACXQ,UAAU;oBACZ;iBACD;gBACDC,WAAW;oBACTC,SAAS;wBACP;4BACEC,aAAa;4BACbC,KAAK;4BACLF,SAAS;mCACJR,MAAMW,aAAa,CAACC,GAAG,CAAC,CAACC;oCAC1B,OAAO,IAAIpB,gBAAgB,WAAWoB,MAAMC,IAAI,EAAE;wCAChDC,MAAMrB;wCACNe,aAAa,CAAC,EAAEO,IAAI,EAAE;4CACpB,IAAI,CAACH,MAAMI,MAAM,CAACC,QAAQ,EAAE;gDAC1B,OAAOL,MAAMC,IAAI;4CACnB;4CAEA,OAAOtB,eAAeqB,MAAMI,MAAM,CAACC,QAAQ,EAAEF;wCAC/C;wCACAG,UAAU;4CAAC;4CAAS;4CAAUN,MAAMC,IAAI;yCAAC;wCACzCM,UAAU,CAAC,EAAEC,MAAM,EAAE;4CACnBA,OAAOC,eAAe,CAACzB,sBAAsB;gDAC3C0B,IAAI;gDACJC,WAAW;gDACXC,WAAWZ,MAAMC,IAAI;4CACvB;wCACF;oCACF;gCACF;6BACD;wBACH;qBACD;gBACH;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAMY,+BAA+B/B,sBAAsBI,qBAAoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/field/features/blocks/feature.server.ts"],"sourcesContent":["import type { Block, BlockField, Field, FieldWithRichTextRequiredEditor } from 'payload/types'\n\nimport { baseBlockFields, sanitizeFields } from 'payload/config'\nimport { fieldsToJSONSchema, formatLabels } from 'payload/utilities'\n\nimport type { FeatureProviderProviderServer } from '../types.js'\nimport type { BlocksFeatureClientProps } from './feature.client.js'\n\nimport { cloneDeep } from '../../lexical/utils/cloneDeep.js'\nimport { BlocksFeatureClientComponent } from './feature.client.js'\nimport { BlockNode } from './nodes/BlocksNode.js'\nimport { blockPopulationPromiseHOC } from './populationPromise.js'\nimport { blockValidationHOC } from './validate.js'\n\nexport type BlocksFeatureProps = {\n blocks: Array<\n Omit<Block, 'fields'> & {\n fields: FieldWithRichTextRequiredEditor[]\n }\n >\n}\n\nexport const BlocksFeature: FeatureProviderProviderServer<\n BlocksFeatureProps,\n BlocksFeatureClientProps\n> = (props) => {\n // Sanitization taken from payload/src/fields/config/sanitize.ts\n\n if (props?.blocks?.length) {\n props.blocks = props.blocks.map((block) => {\n const blockCopy = cloneDeep(block)\n\n return {\n ...blockCopy,\n fields: blockCopy.fields.concat(baseBlockFields),\n labels: !blockCopy.labels ? formatLabels(blockCopy.slug) : blockCopy.labels,\n }\n })\n // unSanitizedBlock.fields are sanitized in the React component and not here.\n // That's because we do not have access to the payload config here.\n }\n\n // Build clientProps\n const clientProps: BlocksFeatureClientProps = {\n reducedBlocks: [],\n }\n for (const block of props.blocks) {\n clientProps.reducedBlocks.push({\n slug: block.slug,\n fieldMap: [],\n imageAltText: block.imageAltText,\n imageURL: block.imageURL,\n labels: block.labels,\n })\n }\n\n return {\n feature: () => {\n return {\n ClientComponent: BlocksFeatureClientComponent,\n clientFeatureProps: clientProps,\n generateSchemaMap: ({ config, props, schemaMap: schemaMapFromProps, schemaPath }) => {\n const schemaMap: {\n [key: string]: Field[]\n } = {}\n\n /**\n * Add sub-fields to the schemaMap. E.g. if you have an array field as part of the block and it runs addRow, it will request these\n * sub-fields from the component map. Thus we need to put them in the component map here.\n */\n const handleFields = (parentPath: string, fields: Field[]) => {\n for (const field of fields) {\n if ('name' in field && 'fields' in field) {\n schemaMap[parentPath + '.' + field.name] = field.fields\n handleFields(parentPath + '.' + field.name, field.fields)\n }\n if ('blocks' in field) {\n for (const block of field.blocks) {\n schemaMap[parentPath + '.' + field.name + '.' + block.slug] = block.fields || []\n handleFields(parentPath + '.' + field.name + '.' + block.slug, block.fields)\n }\n }\n if ('tabs' in field) {\n for (const tab of field.tabs) {\n if ('name' in tab) {\n schemaMap[parentPath + '.' + tab.name] = tab.fields || []\n handleFields(parentPath + '.' + tab.name, tab.fields)\n } else {\n handleFields(parentPath, tab.fields)\n }\n }\n }\n }\n }\n\n for (const block of props.blocks) {\n schemaMap[block.slug] = block.fields || []\n handleFields(block.slug, block.fields)\n }\n\n return schemaMap\n },\n generatedTypes: {\n modifyOutputSchema: ({\n collectionIDFieldTypes,\n config,\n currentSchema,\n field,\n interfaceNameDefinitions,\n }) => {\n if (!props?.blocks?.length) {\n return currentSchema\n }\n\n // sanitize blocks\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n const sanitizedBlocks = props.blocks.map((block) => {\n const blockCopy = cloneDeep(block)\n return {\n ...blockCopy,\n fields: sanitizeFields({\n config,\n fields: blockCopy.fields,\n requireFieldLevelRichTextEditor: true,\n validRelationships,\n }),\n }\n })\n\n const blocksField: BlockField = {\n name: field?.name + '_lexical_blocks',\n type: 'blocks',\n blocks: sanitizedBlocks,\n }\n // This is only done so that interfaceNameDefinitions sets those block's interfaceNames.\n // we don't actually use the JSON Schema itself in the generated types yet.\n fieldsToJSONSchema(\n collectionIDFieldTypes,\n [blocksField],\n interfaceNameDefinitions,\n config,\n )\n\n return currentSchema\n },\n },\n nodes: [\n {\n node: BlockNode,\n populationPromises: [blockPopulationPromiseHOC(props)],\n validations: [blockValidationHOC(props)],\n },\n ],\n serverFeatureProps: props,\n }\n },\n key: 'blocks',\n serverFeatureProps: props,\n }\n}\n"],"names":["baseBlockFields","sanitizeFields","fieldsToJSONSchema","formatLabels","cloneDeep","BlocksFeatureClientComponent","BlockNode","blockPopulationPromiseHOC","blockValidationHOC","BlocksFeature","props","blocks","length","map","block","blockCopy","fields","concat","labels","slug","clientProps","reducedBlocks","push","fieldMap","imageAltText","imageURL","feature","ClientComponent","clientFeatureProps","generateSchemaMap","config","schemaMap","schemaMapFromProps","schemaPath","handleFields","parentPath","field","name","tab","tabs","generatedTypes","modifyOutputSchema","collectionIDFieldTypes","currentSchema","interfaceNameDefinitions","validRelationships","collections","c","sanitizedBlocks","requireFieldLevelRichTextEditor","blocksField","type","nodes","node","populationPromises","validations","serverFeatureProps","key"],"mappings":"AAEA,SAASA,eAAe,EAAEC,cAAc,QAAQ,iBAAgB;AAChE,SAASC,kBAAkB,EAAEC,YAAY,QAAQ,oBAAmB;AAKpE,SAASC,SAAS,QAAQ,mCAAkC;AAC5D,SAASC,4BAA4B,QAAQ,sBAAqB;AAClE,SAASC,SAAS,QAAQ,wBAAuB;AACjD,SAASC,yBAAyB,QAAQ,yBAAwB;AAClE,SAASC,kBAAkB,QAAQ,gBAAe;AAUlD,OAAO,MAAMC,gBAGT,CAACC;IACH,gEAAgE;IAEhE,IAAIA,OAAOC,QAAQC,QAAQ;QACzBF,MAAMC,MAAM,GAAGD,MAAMC,MAAM,CAACE,GAAG,CAAC,CAACC;YAC/B,MAAMC,YAAYX,UAAUU;YAE5B,OAAO;gBACL,GAAGC,SAAS;gBACZC,QAAQD,UAAUC,MAAM,CAACC,MAAM,CAACjB;gBAChCkB,QAAQ,CAACH,UAAUG,MAAM,GAAGf,aAAaY,UAAUI,IAAI,IAAIJ,UAAUG,MAAM;YAC7E;QACF;IACA,8EAA8E;IAC9E,mEAAmE;IACrE;IAEA,oBAAoB;IACpB,MAAME,cAAwC;QAC5CC,eAAe,EAAE;IACnB;IACA,KAAK,MAAMP,SAASJ,MAAMC,MAAM,CAAE;QAChCS,YAAYC,aAAa,CAACC,IAAI,CAAC;YAC7BH,MAAML,MAAMK,IAAI;YAChBI,UAAU,EAAE;YACZC,cAAcV,MAAMU,YAAY;YAChCC,UAAUX,MAAMW,QAAQ;YACxBP,QAAQJ,MAAMI,MAAM;QACtB;IACF;IAEA,OAAO;QACLQ,SAAS;YACP,OAAO;gBACLC,iBAAiBtB;gBACjBuB,oBAAoBR;gBACpBS,mBAAmB,CAAC,EAAEC,MAAM,EAAEpB,KAAK,EAAEqB,WAAWC,kBAAkB,EAAEC,UAAU,EAAE;oBAC9E,MAAMF,YAEF,CAAC;oBAEL;;;WAGC,GACD,MAAM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AAO+B;wBACT;wBAEA,kBAAkB;wBAClB,MAAME,qBAAqBf,OAAOgB,WAAW,CAACjC,GAAG,CAAC,CAACkC,IAAMA,EAAE5B,IAAI,KAAK,EAAE;wBAEtE,MAAM6B,kBAAkBtC,MAAMC,MAAM,CAACE,GAAG,CAAC,CAACC;4BACxC,MAAMC,YAAYX,UAAUU;4BAC5B,OAAO;gCACL,GAAGC,SAAS;gCACZC,QAAQf,eAAe;oCACrB6B;oCACAd,QAAQD,UAAUC,MAAM;oCACxBiC,iCAAiC;oCACjCJ;gCACF;4BACF;wBACF;wBAEA,MAAMK,cAA0B;4BAC9Bb,MAAMD,OAAOC,OAAO;4BACpBc,MAAM;4BACNxC,QAAQqC;wBACV;wBACA,wFAAwF;wBACxF,2EAA2E;wBAC3E9C,mBACEwC,wBACA;4BAACQ;yBAAY,EACbN,0BACAd;wBAGF,OAAOa;oBACT;gBACF;gBACAS,OAAO;oBACL;wBACEC,MAAM/C;wBACNgD,oBAAoB;4BAAC/C,0BAA0BG;yBAAO;wBACtD6C,aAAa;4BAAC/C,mBAAmBE;yBAAO;oBAC1C;iBACD;gBACD8C,oBAAoB9C;YACtB;QACF;QACA+C,KAAK;QACLD,oBAAoB9C;IACtB;AACF,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/features/blocks/feature.server.ts"],"sourcesContent":["import type { Block, BlockField, Field, FieldWithRichTextRequiredEditor } from 'payload/types'\n\nimport { baseBlockFields, sanitizeFields } from 'payload/config'\nimport { fieldsToJSONSchema, formatLabels } from 'payload/utilities'\n\nimport type { FeatureProviderProviderServer } from '../types.js'\nimport type { BlocksFeatureClientProps } from './feature.client.js'\n\nimport { cloneDeep } from '../../lexical/utils/cloneDeep.js'\nimport { BlocksFeatureClientComponent } from './feature.client.js'\nimport { BlockNode } from './nodes/BlocksNode.js'\nimport { blockPopulationPromiseHOC } from './populationPromise.js'\nimport { blockValidationHOC } from './validate.js'\n\nexport type BlocksFeatureProps = {\n blocks: Array<\n Omit<Block, 'fields'> & {\n fields: FieldWithRichTextRequiredEditor[]\n }\n >\n}\n\nexport const BlocksFeature: FeatureProviderProviderServer<\n BlocksFeatureProps,\n BlocksFeatureClientProps\n> = (props) => {\n // Sanitization taken from payload/src/fields/config/sanitize.ts\n\n if (props?.blocks?.length) {\n props.blocks = props.blocks.map((block) => {\n const blockCopy = cloneDeep(block)\n\n return {\n ...blockCopy,\n fields: blockCopy.fields.concat(baseBlockFields),\n labels: !blockCopy.labels ? formatLabels(blockCopy.slug) : blockCopy.labels,\n }\n })\n // unSanitizedBlock.fields are sanitized in the React component and not here.\n // That's because we do not have access to the payload config here.\n }\n\n // Build clientProps\n const clientProps: BlocksFeatureClientProps = {\n reducedBlocks: [],\n }\n for (const block of props.blocks) {\n clientProps.reducedBlocks.push({\n slug: block.slug,\n fieldMap: [],\n imageAltText: block.imageAltText,\n imageURL: block.imageURL,\n labels: block.labels,\n })\n }\n\n return {\n feature: () => {\n return {\n ClientComponent: BlocksFeatureClientComponent,\n clientFeatureProps: clientProps,\n generateSchemaMap: ({ config, props, schemaMap: schemaMapFromProps, schemaPath }) => {\n const schemaMap: {\n [key: string]: Field[]\n } = {}\n\n /**\n * Add sub-fields to the schemaMap. E.g. if you have an array field as part of the block and it runs addRow, it will request these\n * sub-fields from the component map. Thus we need to put them in the component map here.\n */\n const handleFields = (parentPath: string, fields: Field[]) => {\n for (const field of fields) {\n if ('name' in field && 'fields' in field) {\n schemaMap[parentPath + '.' + field.name] = field.fields\n handleFields(parentPath + '.' + field.name, field.fields)\n }\n if ('blocks' in field) {\n for (const block of field.blocks) {\n schemaMap[parentPath + '.' + field.name + '.' + block.slug] = block.fields || []\n handleFields(parentPath + '.' + field.name + '.' + block.slug, block.fields)\n }\n }\n if ('tabs' in field) {\n for (const tab of field.tabs) {\n if ('name' in tab) {\n schemaMap[parentPath + '.' + tab.name] = tab.fields || []\n handleFields(parentPath + '.' + tab.name, tab.fields)\n } else {\n handleFields(parentPath, tab.fields)\n }\n }\n }\n }\n }\n\n for (const block of props.blocks) {\n schemaMap[block.slug] = block.fields || []\n handleFields(block.slug, block.fields)\n }\n\n return schemaMap\n },\n generatedTypes: {\n modifyOutputSchema: ({\n collectionIDFieldTypes,\n config,\n currentSchema,\n field,\n interfaceNameDefinitions,\n }) => {\n if (!props?.blocks?.length) {\n return currentSchema\n }\n\n // sanitize blocks\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n const sanitizedBlocks = props.blocks.map((block) => {\n const blockCopy = cloneDeep(block)\n return {\n ...blockCopy,\n fields: sanitizeFields({\n config,\n fields: blockCopy.fields,\n requireFieldLevelRichTextEditor: true,\n validRelationships,\n }),\n }\n })\n\n const blocksField: BlockField = {\n name: field?.name + '_lexical_blocks',\n type: 'blocks',\n blocks: sanitizedBlocks,\n }\n // This is only done so that interfaceNameDefinitions sets those block's interfaceNames.\n // we don't actually use the JSON Schema itself in the generated types yet.\n fieldsToJSONSchema(\n collectionIDFieldTypes,\n [blocksField],\n interfaceNameDefinitions,\n config,\n )\n\n return currentSchema\n },\n },\n nodes: [\n {\n node: BlockNode,\n populationPromises: [blockPopulationPromiseHOC(props)],\n validations: [blockValidationHOC(props)],\n },\n ],\n serverFeatureProps: props,\n }\n },\n key: 'blocks',\n serverFeatureProps: props,\n }\n}\n"],"names":["baseBlockFields","sanitizeFields","fieldsToJSONSchema","formatLabels","cloneDeep","BlocksFeatureClientComponent","BlockNode","blockPopulationPromiseHOC","blockValidationHOC","BlocksFeature","props","blocks","length","map","block","blockCopy","fields","concat","labels","slug","clientProps","reducedBlocks","push","fieldMap","imageAltText","imageURL","feature","ClientComponent","clientFeatureProps","generateSchemaMap","config","schemaMap","schemaMapFromProps","schemaPath","handleFields","parentPath","field","name","tab","tabs","generatedTypes","modifyOutputSchema","collectionIDFieldTypes","currentSchema","interfaceNameDefinitions","validRelationships","collections","c","sanitizedBlocks","requireFieldLevelRichTextEditor","blocksField","type","nodes","node","populationPromises","validations","serverFeatureProps","key"],"rangeMappings":";;;;;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EACbP,KAAK,EACLQ,wBAAwB,EACzB;wBACC,IAAI,CAAClC,OAAOC,QAAQC,QAAQ;4BAC1B,OAAO+B;wBACT;wBAEA,kBAAkB;wBAClB,MAAME,qBAAqBf,OAAOgB,WAAW,CAACjC,GAAG,CAAC,CAACkC,IAAMA,EAAE5B,IAAI,KAAK,EAAE;wBAEtE,MAAM6B,kBAAkBtC,MAAMC,MAAM,CAACE,GAAG,CAAC,CAACC;4BACxC,MAAMC,YAAYX,UAAUU;4BAC5B,OAAO;gCACL,GAAGC,SAAS;gCACZC,QAAQf,eAAe;oCACrB6B;oCACAd,QAAQD,UAAUC,MAAM;oCACxBiC,iCAAiC;oCACjCJ;gCACF;4BACF;wBACF;wBAEA,MAAMK,cAA0B;4BAC9Bb,MAAMD,OAAOC,OAAO;4BACpBc,MAAM;4BACNxC,QAAQqC;wBACV;wBACA,wFAAwF;wBACxF,2EAA2E;wBAC3E9C,mBACEwC,wBACA;4BAACQ;yBAAY,EACbN,0BACAd;wBAGF,OAAOa;oBACT;gBACF;gBACAS,OAAO;oBACL;wBACEC,MAAM/C;wBACNgD,oBAAoB;4BAAC/C,0BAA0BG;yBAAO;wBACtD6C,aAAa;4BAAC/C,mBAAmBE;yBAAO;oBAC1C;iBACD;gBACD8C,oBAAoB9C;YACtB;QACF;QACA+C,KAAK;QACLD,oBAAoB9C;IACtB;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/features/blocks/nodes/BlocksNode.tsx"],"sourcesContent":["import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type {\n DOMConversionMap,\n DOMExportOutput,\n EditorConfig,\n ElementFormatType,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n Spread,\n} from 'lexical'\n\nimport lexicalDecoratorBlockNodeImport from '@lexical/react/LexicalDecoratorBlockNode.js'\nconst { DecoratorBlockNode } = lexicalDecoratorBlockNodeImport\nimport ObjectID from 'bson-objectid'\nimport React from 'react'\n\nexport type BlockFields = {\n /** Block form data */\n [key: string]: any\n blockName: string\n blockType: string\n id: string\n}\n\nconst BlockComponent = React.lazy(() =>\n import('../component/index.js').then((module) => ({\n default: module.BlockComponent,\n })),\n)\n\nexport type SerializedBlockNode = Spread<\n {\n fields: BlockFields\n },\n SerializedDecoratorBlockNode\n>\n\nexport class BlockNode extends DecoratorBlockNode {\n __fields: BlockFields\n\n constructor({\n fields,\n format,\n key,\n }: {\n fields: BlockFields\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__fields = fields\n }\n\n static clone(node: BlockNode): BlockNode {\n return new BlockNode({\n fields: node.__fields,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static getType(): string {\n return 'block'\n }\n\n static importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static importJSON(serializedNode: SerializedBlockNode): BlockNode {\n if (serializedNode.version === 1) {\n // Convert (version 1 had the fields wrapped in another, unnecessary data property)\n serializedNode = {\n ...serializedNode,\n fields: {\n ...(serializedNode as any).fields.data,\n },\n version: 2,\n }\n }\n const node = $createBlockNode(serializedNode.fields)\n node.setFormat(serializedNode.format)\n return node\n }\n\n static isInline(): false {\n return false\n }\n decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n // @ts-expect-error\n return <BlockComponent formData={this.getFields()} nodeKey={this.getKey()} />\n }\n\n exportDOM(): DOMExportOutput {\n const element = document.createElement('div')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n exportJSON(): SerializedBlockNode {\n return {\n ...super.exportJSON(),\n type: this.getType(),\n fields: this.getFields(),\n version: 2,\n }\n }\n\n getFields(): BlockFields {\n return this.getLatest().__fields\n }\n\n getTextContent(): string {\n return `Block Field`\n }\n\n setFields(fields: BlockFields): void {\n const fieldsCopy = JSON.parse(JSON.stringify(fields)) as BlockFields\n\n const writable = this.getWritable()\n writable.__fields = fieldsCopy\n }\n}\n\nexport function $createBlockNode(fields: Exclude<BlockFields, 'id'>): BlockNode {\n return new BlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n })\n}\n\nexport function $isBlockNode(node: BlockNode | LexicalNode | null | undefined): node is BlockNode {\n return node instanceof BlockNode\n}\n"],"names":["lexicalDecoratorBlockNodeImport","DecoratorBlockNode","ObjectID","React","BlockComponent","lazy","then","module","default","BlockNode","__fields","constructor","fields","format","key","clone","node","__format","__key","getType","importDOM","importJSON","serializedNode","version","data","$createBlockNode","setFormat","isInline","decorate","editor","config","formData","getFields","nodeKey","getKey","exportDOM","element","document","createElement","text","createTextNode","getTextContent","append","exportJSON","type","getLatest","setFields","fieldsCopy","JSON","parse","stringify","writable","getWritable","id","toHexString","$isBlockNode"],"mappings":"AAYA,OAAOA,qCAAqC,8CAA6C;AACzF,MAAM,EAAEC,kBAAkB,EAAE,GAAGD;AAC/B,OAAOE,cAAc,gBAAe;AACpC,OAAOC,WAAW,QAAO;AAUzB,MAAMC,+BAAiBD,MAAME,IAAI,CAAC,IAChC,MAAM,CAAC,yBAAyBC,IAAI,CAAC,CAACC,SAAY,CAAA;YAChDC,SAASD,OAAOH,cAAc;QAChC,CAAA;AAUF,OAAO,MAAMK,kBAAkBR;IAC7BS,SAAqB;IAErBC,YAAY,EACVC,MAAM,EACNC,MAAM,EACNC,GAAG,EAKJ,CAAE;QACD,KAAK,CAACD,QAAQC;QACd,IAAI,CAACJ,QAAQ,GAAGE;IAClB;IAEA,OAAOG,MAAMC,IAAe,EAAa;QACvC,OAAO,IAAIP,UAAU;YACnBG,QAAQI,KAAKN,QAAQ;YACrBG,QAAQG,KAAKC,QAAQ;YACrBH,KAAKE,KAAKE,KAAK;QACjB;IACF;IAEA,OAAOC,UAAkB;QACvB,OAAO;IACT;IAEA,OAAOC,YAAqD;QAC1D,OAAO,CAAC;IACV;IAEA,OAAOC,WAAWC,cAAmC,EAAa;QAChE,IAAIA,eAAeC,OAAO,KAAK,GAAG;YAChC,mFAAmF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AAOA,gBAAgBP;AACzB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/features/blocks/nodes/BlocksNode.tsx"],"sourcesContent":["import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type {\n DOMConversionMap,\n DOMExportOutput,\n EditorConfig,\n ElementFormatType,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n Spread,\n} from 'lexical'\n\nimport lexicalDecoratorBlockNodeImport from '@lexical/react/LexicalDecoratorBlockNode.js'\nconst { DecoratorBlockNode } = lexicalDecoratorBlockNodeImport\nimport ObjectID from 'bson-objectid'\nimport React from 'react'\n\nexport type BlockFields = {\n /** Block form data */\n [key: string]: any\n blockName: string\n blockType: string\n id: string\n}\n\nconst BlockComponent = React.lazy(() =>\n import('../component/index.js').then((module) => ({\n default: module.BlockComponent,\n })),\n)\n\nexport type SerializedBlockNode = Spread<\n {\n fields: BlockFields\n },\n SerializedDecoratorBlockNode\n>\n\nexport class BlockNode extends DecoratorBlockNode {\n __fields: BlockFields\n\n constructor({\n fields,\n format,\n key,\n }: {\n fields: BlockFields\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__fields = fields\n }\n\n static clone(node: BlockNode): BlockNode {\n return new BlockNode({\n fields: node.__fields,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static getType(): string {\n return 'block'\n }\n\n static importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static importJSON(serializedNode: SerializedBlockNode): BlockNode {\n if (serializedNode.version === 1) {\n // Convert (version 1 had the fields wrapped in another, unnecessary data property)\n serializedNode = {\n ...serializedNode,\n fields: {\n ...(serializedNode as any).fields.data,\n },\n version: 2,\n }\n }\n const node = $createBlockNode(serializedNode.fields)\n node.setFormat(serializedNode.format)\n return node\n }\n\n static isInline(): false {\n return false\n }\n decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n // @ts-expect-error\n return <BlockComponent formData={this.getFields()} nodeKey={this.getKey()} />\n }\n\n exportDOM(): DOMExportOutput {\n const element = document.createElement('div')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n exportJSON(): SerializedBlockNode {\n return {\n ...super.exportJSON(),\n type: this.getType(),\n fields: this.getFields(),\n version: 2,\n }\n }\n\n getFields(): BlockFields {\n return this.getLatest().__fields\n }\n\n getTextContent(): string {\n return `Block Field`\n }\n\n setFields(fields: BlockFields): void {\n const fieldsCopy = JSON.parse(JSON.stringify(fields)) as BlockFields\n\n const writable = this.getWritable()\n writable.__fields = fieldsCopy\n }\n}\n\nexport function $createBlockNode(fields: Exclude<BlockFields, 'id'>): BlockNode {\n return new BlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n })\n}\n\nexport function $isBlockNode(node: BlockNode | LexicalNode | null | undefined): node is BlockNode {\n return node instanceof BlockNode\n}\n"],"names":["lexicalDecoratorBlockNodeImport","DecoratorBlockNode","ObjectID","React","BlockComponent","lazy","then","module","default","BlockNode","__fields","constructor","fields","format","key","clone","node","__format","__key","getType","importDOM","importJSON","serializedNode","version","data","$createBlockNode","setFormat","isInline","decorate","editor","config","formData","getFields","nodeKey","getKey","exportDOM","element","document","createElement","text","createTextNode","getTextContent","append","exportJSON","type","getLatest","setFields","fieldsCopy","JSON","parse","stringify","writable","getWritable","id","toHexString","$isBlockNode"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAYA,OAAOA,qCAAqC,8CAA6C;AACzF,MAAM,EAAEC,kBAAkB,EAAE,GAAGD;AAC/B,OAAOE,cAAc,gBAAe;AACpC,OAAOC,WAAW,QAAO;AAUzB,MAAMC,+BAAiBD,MAAME,IAAI,CAAC,IAChC,MAAM,CAAC,yBAAyBC,IAAI,CAAC,CAACC,SAAY,CAAA;YAChDC,SAASD,OAAOH,cAAc;QAChC,CA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yB;QACvB,OAAO,IAAI,CAACa,SAAS,GAAGnC,QAAQ;IAClC;IAEA+B,iBAAyB;QACvB,OAAO,CAAC,WAAW,CAAC;IACtB;IAEAK,UAAUlC,MAAmB,EAAQ;QACnC,MAAMmC,aAAaC,KAAKC,KAAK,CAACD,KAAKE,SAAS,CAACtC;QAE7C,MAAMuC,WAAW,IAAI,CAACC,WAAW;QACjCD,SAASzC,QAAQ,GAAGqC;IACtB;AACF;AAEA,OAAO,SAAStB,iBAAiBb,MAAkC;IACjE,OAAO,IAAIH,UAAU;QACnBG,QAAQ;YACN,GAAGA,MAAM;YACTyC,IAAIzC,QAAQyC,MAAM,IAAInD,SAASM,OAAO,GAAG8C,WAAW;QACtD;IACF;AACF;AAEA,OAAO,SAASC,aAAavC,IAAgD;IAC3E,OAAOA,gBAAgBP;AACzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/features/blocks/plugin/commands.ts"],"sourcesContent":["import type { LexicalCommand } from 'lexical'\n\nimport lexicalImport from 'lexical'\nconst { createCommand } = lexicalImport\n\nimport type { InsertBlockPayload } from './index.js'\n\nexport const INSERT_BLOCK_COMMAND: LexicalCommand<InsertBlockPayload> =\n createCommand('INSERT_BLOCK_COMMAND')\n"],"names":["lexicalImport","createCommand","INSERT_BLOCK_COMMAND"],"mappings":"AAEA,OAAOA,mBAAmB,UAAS;AACnC,MAAM,EAAEC,aAAa,EAAE,GAAGD;AAI1B,OAAO,MAAME,uBACXD,cAAc,wBAAuB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/features/blocks/plugin/commands.ts"],"sourcesContent":["import type { LexicalCommand } from 'lexical'\n\nimport lexicalImport from 'lexical'\nconst { createCommand } = lexicalImport\n\nimport type { InsertBlockPayload } from './index.js'\n\nexport const INSERT_BLOCK_COMMAND: LexicalCommand<InsertBlockPayload> =\n createCommand('INSERT_BLOCK_COMMAND')\n"],"names":["lexicalImport","createCommand","INSERT_BLOCK_COMMAND"],"rangeMappings":";;","mappings":"AAEA,OAAOA,mBAAmB,UAAS;AACnC,MAAM,EAAEC,aAAa,EAAE,GAAGD;AAI1B,OAAO,MAAME,uBACXD,cAAc,wBAAuB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/features/blocks/plugin/index.tsx"],"sourcesContent":["'use client'\nimport lexicalComposerContextImport from '@lexical/react/LexicalComposerContext.js'\nconst { useLexicalComposerContext } = lexicalComposerContextImport\nimport lexicalUtilsImport from '@lexical/utils'\nconst { $insertNodeToNearestRoot, mergeRegister } = lexicalUtilsImport\nimport lexicalImport from 'lexical'\nconst {\n $getPreviousSelection,\n $getSelection,\n $isParagraphNode,\n $isRangeSelection,\n COMMAND_PRIORITY_EDITOR,\n} = lexicalImport\n\nimport React, { useEffect } from 'react'\n\nimport type { BlockFields } from '../nodes/BlocksNode.js'\n\nimport { BlocksDrawerComponent } from '../drawer/index.js'\nimport { $createBlockNode, BlockNode } from '../nodes/BlocksNode.js'\nimport { INSERT_BLOCK_COMMAND } from './commands.js'\n\nexport type InsertBlockPayload = Exclude<BlockFields, 'id'>\n\nexport function BlocksPlugin(): React.ReactNode {\n const [editor] = useLexicalComposerContext()\n\n useEffect(() => {\n if (!editor.hasNodes([BlockNode])) {\n throw new Error('BlocksPlugin: BlocksNode not registered on editor')\n }\n\n return mergeRegister(\n editor.registerCommand<InsertBlockPayload>(\n INSERT_BLOCK_COMMAND,\n (payload: InsertBlockPayload) => {\n editor.update(() => {\n const blockNode = $createBlockNode(payload)\n\n const selection = $getSelection() || $getPreviousSelection()\n\n if ($isRangeSelection(selection)) {\n const { focus } = selection\n const focusNode = focus.getNode()\n\n // First, delete currently selected node if it's an empty paragraph and if there are sufficient\n // paragraph nodes (more than 1) left in the parent node, so that we don't \"trap\" the user\n if (\n $isParagraphNode(focusNode) &&\n focusNode.getTextContentSize() === 0 &&\n focusNode\n .getParent()\n .getChildren()\n .filter((node) => $isParagraphNode(node)).length > 1\n ) {\n focusNode.remove()\n }\n\n $insertNodeToNearestRoot(blockNode)\n }\n })\n\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n ),\n )\n }, [editor])\n\n return <BlocksDrawerComponent />\n}\n"],"names":["lexicalComposerContextImport","useLexicalComposerContext","lexicalUtilsImport","$insertNodeToNearestRoot","mergeRegister","lexicalImport","$getPreviousSelection","$getSelection","$isParagraphNode","$isRangeSelection","COMMAND_PRIORITY_EDITOR","React","useEffect","BlocksDrawerComponent","$createBlockNode","BlockNode","INSERT_BLOCK_COMMAND","BlocksPlugin","editor","hasNodes","Error","registerCommand","payload","update","blockNode","selection","focus","focusNode","getNode","getTextContentSize","getParent","getChildren","filter","node","length","remove"],"mappings":"AAAA;AACA,OAAOA,kCAAkC,2CAA0C;AACnF,MAAM,EAAEC,yBAAyB,EAAE,GAAGD;AACtC,OAAOE,wBAAwB,iBAAgB;AAC/C,MAAM,EAAEC,wBAAwB,EAAEC,aAAa,EAAE,GAAGF;AACpD,OAAOG,mBAAmB,UAAS;AACnC,MAAM,EACJC,qBAAqB,EACrBC,aAAa,EACbC,gBAAgB,EAChBC,iBAAiB,EACjBC,uBAAuB,EACxB,GAAGL;AAEJ,OAAOM,SAASC,SAAS,QAAQ,QAAO;AAIxC,SAASC,qBAAqB,QAAQ,qBAAoB;AAC1D,SAASC,gBAAgB,EAAEC,SAAS,QAAQ,yBAAwB;AACpE,SAASC,oBAAoB,QAAQ,gBAAe;AAIpD,OAAO,SAASC;IACd,MAAM,CAACC,OAAO,GAAGjB;IAEjBW,UAAU;QACR,IAAI,CAACM,OAAOC,QAAQ,CAAC;YAACJ;SAAU,GAAG;YACjC,MAAM,IAAIK,MAAM;QAClB;QAEA,OAAOhB,cACLc,OAAOG,eAAe,CACpBL,sBACA,CAACM;YACCJ,OAAOK,MAAM,CAAC;gBACZ,MAAMC,YAAYV,iBAAiBQ;gBAEnC,MAAMG,YAAYlB,mBAAmBD;gBAErC,IAAIG,kBAAkBgB,YAAY;oBAChC,MAAM,EAAEC,KAAK,EAAE,GAAGD;oBAClB,MAAME,YAAYD,MAAME,OAAO;oBAE/B,+FAA+F;oBAC/F,0FAA0F;oBAC1F,IACEpB,iBAAiBmB,cACjBA,UAAUE,kBAAkB,OAAO,KACnCF,UACGG,SAAS,GACTC,WAAW,GACXC,MAAM,CAAC,CAACC,OAASzB,iBAAiByB,OAAOC,MAAM,GAAG,GACrD;wBACAP,UAAUQ,MAAM;oBAClB;oBAEAhC,yBAAyBqB;gBAC3B;YACF;YAEA,OAAO;QACT,GACAd;IAGN,GAAG;QAACQ;KAAO;IAEX,qBAAO,oBAACL;AACV"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/features/blocks/plugin/index.tsx"],"sourcesContent":["'use client'\nimport lexicalComposerContextImport from '@lexical/react/LexicalComposerContext.js'\nconst { useLexicalComposerContext } = lexicalComposerContextImport\nimport lexicalUtilsImport from '@lexical/utils'\nconst { $insertNodeToNearestRoot, mergeRegister } = lexicalUtilsImport\nimport lexicalImport from 'lexical'\nconst {\n $getPreviousSelection,\n $getSelection,\n $isParagraphNode,\n $isRangeSelection,\n COMMAND_PRIORITY_EDITOR,\n} = lexicalImport\n\nimport React, { useEffect } from 'react'\n\nimport type { BlockFields } from '../nodes/BlocksNode.js'\n\nimport { BlocksDrawerComponent } from '../drawer/index.js'\nimport { $createBlockNode, BlockNode } from '../nodes/BlocksNode.js'\nimport { INSERT_BLOCK_COMMAND } from './commands.js'\n\nexport type InsertBlockPayload = Exclude<BlockFields, 'id'>\n\nexport function BlocksPlugin(): React.ReactNode {\n const [editor] = useLexicalComposerContext()\n\n useEffect(() => {\n if (!editor.hasNodes([BlockNode])) {\n throw new Error('BlocksPlugin: BlocksNode not registered on editor')\n }\n\n return mergeRegister(\n editor.registerCommand<InsertBlockPayload>(\n INSERT_BLOCK_COMMAND,\n (payload: InsertBlockPayload) => {\n editor.update(() => {\n const blockNode = $createBlockNode(payload)\n\n const selection = $getSelection() || $getPreviousSelection()\n\n if ($isRangeSelection(selection)) {\n const { focus } = selection\n const focusNode = focus.getNode()\n\n // First, delete currently selected node if it's an empty paragraph and if there are sufficient\n // paragraph nodes (more than 1) left in the parent node, so that we don't \"trap\" the user\n if (\n $isParagraphNode(focusNode) &&\n focusNode.getTextContentSize() === 0 &&\n focusNode\n .getParent()\n .getChildren()\n .filter((node) => $isParagraphNode(node)).length > 1\n ) {\n focusNode.remove()\n }\n\n $insertNodeToNearestRoot(blockNode)\n }\n })\n\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n ),\n )\n }, [editor])\n\n return <BlocksDrawerComponent />\n}\n"],"names":["lexicalComposerContextImport","useLexicalComposerContext","lexicalUtilsImport","$insertNodeToNearestRoot","mergeRegister","lexicalImport","$getPreviousSelection","$getSelection","$isParagraphNode","$isRangeSelection","COMMAND_PRIORITY_EDITOR","React","useEffect","BlocksDrawerComponent","$createBlockNode","BlockNode","INSERT_BLOCK_COMMAND","BlocksPlugin","editor","hasNodes","Error","registerCommand","payload","update","blockNode","selection","focus","focusNode","getNode","getTextContentSize","getParent","getChildren","filter","node","length","remove"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AACA,OAAOA,kCAAkC,2CAA0C;AACnF,MAAM,EAAEC,yBAAyB,EAAE,GAAGD;AACtC,OAAOE,wBAAwB,iBAAgB;AAC/C,MAAM,EAAEC,wBAAwB,EAAEC,aAAa,EAAE,GAAGF;AACpD,OAAOG,mBAAmB,UAAS;AACnC,MAAM,EACJC,qBAAqB,EACrBC,aAAa,EACbC,gBAAgB,EAChBC,iBAAiB,EACjBC,uBAAuB,EACxB,GAAGL;AAEJ,OAAOM,SAASC,SAAS,QAAQ,QAAO;AAIxC,SAASC,qBAAqB,QAAQ,qBAAoB;AAC1D,SAASC,gBAAgB,EAAEC,SAAS,QAAQ,yBAAwB;AACpE,SAASC,oBAAoB,QAAQ,gBAAe;AAIpD,OAAO,SAASC;IACd,MAAM,CAACC,OAAO,GAAG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