@payloadcms/richtext-lexical 4.0.0-internal.8001944 → 4.0.0-internal.8089ef7

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.
Files changed (148) hide show
  1. package/dist/exports/client/Field-MT4FK3IP.js +2 -0
  2. package/dist/exports/client/{Field-2HOFHTFX.js.map → Field-MT4FK3IP.js.map} +1 -1
  3. package/dist/exports/client/chunk-E6LSRRP2.js +2 -0
  4. package/dist/exports/client/{chunk-ATPSL6IX.js.map → chunk-E6LSRRP2.js.map} +3 -3
  5. package/dist/exports/client/chunk-ZQX5HXUL.js +2 -0
  6. package/dist/exports/client/{chunk-43E5QYAA.js.map → chunk-ZQX5HXUL.js.map} +3 -3
  7. package/dist/exports/client/{component-D5QLYS7W.js → component-6DQLENIE.js} +2 -2
  8. package/dist/exports/client/{componentInline-ZEP5JPTC.js → componentInline-HNE5G4TE.js} +2 -2
  9. package/dist/exports/client/index.js +28 -28
  10. package/dist/exports/client/index.js.map +4 -4
  11. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  12. package/dist/features/blocks/client/component/index.js +1 -0
  13. package/dist/features/blocks/client/component/index.js.map +1 -1
  14. package/dist/features/blocks/client/componentInline/index.css +0 -1
  15. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  16. package/dist/features/blocks/client/nodes/BlocksNode.js +0 -10
  17. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  18. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  19. package/dist/features/blocks/server/nodes/BlocksNode.js +1 -12
  20. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  21. package/dist/features/blocks/server/nodes/InlineBlocksNode.js +2 -2
  22. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  23. package/dist/features/blocks/server/schema.d.ts +2 -0
  24. package/dist/features/blocks/server/schema.d.ts.map +1 -1
  25. package/dist/features/blocks/server/schema.js +7 -9
  26. package/dist/features/blocks/server/schema.js.map +1 -1
  27. package/dist/features/blocks/server/validate.js +1 -1
  28. package/dist/features/blocks/server/validate.js.map +1 -1
  29. package/dist/features/converters/lexicalToHtml/async/converters/upload.js +3 -3
  30. package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
  31. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js +3 -3
  32. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
  33. package/dist/features/converters/lexicalToJSX/converter/converters/upload.d.ts.map +1 -1
  34. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js +4 -5
  35. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
  36. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +11 -1
  37. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  38. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js +17 -0
  39. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  40. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js +2 -2
  41. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  42. package/dist/features/horizontalRule/server/schema.d.ts +1 -0
  43. package/dist/features/horizontalRule/server/schema.d.ts.map +1 -1
  44. package/dist/features/horizontalRule/server/schema.js +6 -5
  45. package/dist/features/horizontalRule/server/schema.js.map +1 -1
  46. package/dist/features/link/client/plugins/floatingLinkEditor/index.css +0 -1
  47. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  48. package/dist/features/link/nodes/AutoLinkNode.js +2 -10
  49. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  50. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  51. package/dist/features/link/nodes/LinkNode.js +2 -15
  52. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  53. package/dist/features/link/server/validate.js +1 -1
  54. package/dist/features/link/server/validate.js.map +1 -1
  55. package/dist/features/relationship/client/components/index.css +3 -6
  56. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  57. package/dist/features/relationship/client/nodes/RelationshipNode.js +0 -3
  58. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  59. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  60. package/dist/features/relationship/server/nodes/RelationshipNode.js +1 -5
  61. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  62. package/dist/features/relationship/server/schema.d.ts +1 -0
  63. package/dist/features/relationship/server/schema.d.ts.map +1 -1
  64. package/dist/features/relationship/server/schema.js +4 -2
  65. package/dist/features/relationship/server/schema.js.map +1 -1
  66. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.css +0 -1
  67. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.css +0 -3
  68. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  69. package/dist/features/toolbars/fixed/client/Toolbar/index.js +15 -0
  70. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  71. package/dist/features/toolbars/inline/client/Toolbar/index.d.ts.map +1 -1
  72. package/dist/features/toolbars/inline/client/Toolbar/index.js +15 -0
  73. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  74. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +0 -1
  75. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.d.ts +5 -0
  76. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.d.ts.map +1 -0
  77. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.js +79 -0
  78. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.js.map +1 -0
  79. package/dist/features/typesServer.d.ts +3 -3
  80. package/dist/features/typesServer.d.ts.map +1 -1
  81. package/dist/features/typesServer.js.map +1 -1
  82. package/dist/features/upload/client/component/index.css +0 -2
  83. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  84. package/dist/features/upload/client/nodes/UploadNode.js +0 -7
  85. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  86. package/dist/features/upload/server/index.d.ts +1 -1
  87. package/dist/features/upload/server/index.d.ts.map +1 -1
  88. package/dist/features/upload/server/index.js.map +1 -1
  89. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  90. package/dist/features/upload/server/nodes/UploadNode.js +1 -9
  91. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  92. package/dist/features/upload/server/schema.d.ts +2 -14
  93. package/dist/features/upload/server/schema.d.ts.map +1 -1
  94. package/dist/features/upload/server/schema.js +4 -2
  95. package/dist/features/upload/server/schema.js.map +1 -1
  96. package/dist/features/upload/server/validate.js +1 -1
  97. package/dist/features/upload/server/validate.js.map +1 -1
  98. package/dist/field/Diff/converters/relationship/index.css +0 -1
  99. package/dist/field/Diff/converters/unknown/index.css +0 -1
  100. package/dist/field/Diff/converters/upload/index.css +0 -1
  101. package/dist/field/Diff/converters/upload/index.js.map +1 -1
  102. package/dist/field/Diff/index.css +0 -2
  103. package/dist/field/Diff/index.d.ts.map +1 -1
  104. package/dist/field/Diff/index.js +2 -2
  105. package/dist/field/Diff/index.js.map +1 -1
  106. package/dist/field/bundled.css +1 -1
  107. package/dist/field/index.css +0 -1
  108. package/dist/field/rscEntry.d.ts +2 -2
  109. package/dist/field/rscEntry.d.ts.map +1 -1
  110. package/dist/field/rscEntry.js.map +1 -1
  111. package/dist/index.d.ts +3 -3
  112. package/dist/index.d.ts.map +1 -1
  113. package/dist/index.js +22 -0
  114. package/dist/index.js.map +1 -1
  115. package/dist/lexical/LexicalEditor.css +1 -1
  116. package/dist/lexical/plugins/SlashMenu/index.css +0 -1
  117. package/dist/lexical/theme/EditorTheme.css +0 -2
  118. package/dist/presets/llmInstructions.d.ts +2 -0
  119. package/dist/presets/llmInstructions.d.ts.map +1 -0
  120. package/dist/presets/llmInstructions.js +13 -0
  121. package/dist/presets/llmInstructions.js.map +1 -0
  122. package/dist/types/builtInNodes.d.ts +1 -1
  123. package/dist/types/builtInNodes.d.ts.map +1 -1
  124. package/dist/types/builtInNodes.js +8 -3
  125. package/dist/types/builtInNodes.js.map +1 -1
  126. package/dist/types/index.d.ts +3 -6
  127. package/dist/types/index.d.ts.map +1 -1
  128. package/dist/types/index.js.map +1 -1
  129. package/dist/types/jsonSchemaHelpers.d.ts +5 -1
  130. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -1
  131. package/dist/types/jsonSchemaHelpers.js +7 -2
  132. package/dist/types/jsonSchemaHelpers.js.map +1 -1
  133. package/dist/types/nodeTypes.d.ts +5 -0
  134. package/dist/types/nodeTypes.d.ts.map +1 -1
  135. package/dist/types/nodeTypes.js.map +1 -1
  136. package/dist/utilities/buildInitialState.d.ts +2 -2
  137. package/dist/utilities/buildInitialState.d.ts.map +1 -1
  138. package/dist/utilities/buildInitialState.js.map +1 -1
  139. package/dist/utilities/generateImportMap.d.ts +2 -2
  140. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  141. package/dist/utilities/generateImportMap.js.map +1 -1
  142. package/package.json +6 -6
  143. package/dist/exports/client/Field-2HOFHTFX.js +0 -2
  144. package/dist/exports/client/bundled.css +0 -1
  145. package/dist/exports/client/chunk-43E5QYAA.js +0 -2
  146. package/dist/exports/client/chunk-ATPSL6IX.js +0 -2
  147. /package/dist/exports/client/{component-D5QLYS7W.js.map → component-6DQLENIE.js.map} +0 -0
  148. /package/dist/exports/client/{componentInline-ZEP5JPTC.js.map → componentInline-HNE5G4TE.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/types/index.ts"],"sourcesContent":["import type {\n DecoratorNode,\n EditorConfig,\n LexicalEditor,\n EditorConfig as LexicalEditorConfig,\n LexicalNode,\n SerializedEditorState,\n SerializedLexicalNode,\n} from 'lexical'\nimport type {\n ClientField,\n DefaultServerCellComponentProps,\n LabelFunction,\n PayloadComponent,\n RichTextAdapter,\n RichTextField,\n RichTextFieldClient,\n RichTextFieldClientProps,\n SanitizedConfig,\n ServerFieldBase,\n StaticLabel,\n} from 'payload'\n\nimport type { BlockComponentContextType } from '../features/blocks/client/component/BlockContent.js'\nexport type { BlockComponentContextType }\nimport type { BlockComponentProps } from '../features/blocks/client/component/index.js'\nimport type { InlineBlockComponentContextType } from '../features/blocks/client/componentInline/index.js'\nimport type {\n JSXConverterArgs,\n JSXConverters,\n SerializedLexicalNodeWithParent,\n} from '../features/converters/lexicalToJSX/converter/types.js'\nimport type {\n BaseClientFeatureProps,\n FeatureProviderProviderClient,\n} from '../features/typesClient.js'\nimport type { FeatureProviderServer } from '../features/typesServer.js'\nimport type { SanitizedServerEditorConfig } from '../lexical/config/types.js'\nimport type { InitialLexicalFormState } from '../utilities/buildInitialState.js'\nimport type {\n DefaultNodeTypes,\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from './nodeTypes.js'\n\n/**\n * Base constraint for serialized Lexical node types.\n * Used as the generic constraint for node map types.\n * Extends the base SerializedLexicalNode with optional type for flexibility.\n */\nexport type SerializedNodeBase = { type?: string }\n\nexport type LexicalFieldAdminProps = {\n /**\n * Controls if the add block button should be hidden. @default false\n */\n hideAddBlockButton?: boolean\n /**\n * Controls if the draggable block element should be hidden. @default false\n */\n hideDraggableBlockElement?: boolean\n /**\n * Controls if the gutter (padding to the left & gray vertical line) should be hidden. @default false\n */\n hideGutter?: boolean\n /**\n * Controls if the insert paragraph at the end button should be hidden. @default false\n */\n hideInsertParagraphAtEnd?: boolean\n /**\n * Changes the placeholder text in the editor if no content is present.\n */\n placeholder?: LabelFunction | StaticLabel\n}\n\nexport type LexicalFieldAdminClientProps = {\n placeholder?: string\n} & Omit<LexicalFieldAdminProps, 'placeholder'>\n\nexport type FeaturesInput =\n | (({\n defaultFeatures,\n rootFeatures,\n }: {\n /**\n * This opinionated array contains all \"recommended\" default features.\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ defaultFeatures }) => [...defaultFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n defaultFeatures: FeatureProviderServer<any, any, any>[]\n /**\n * This array contains all features that are enabled in the root richText editor (the one defined in the payload.config.ts).\n * If this field is the root richText editor, or if the root richText editor is not a lexical editor, this array will be empty.\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ rootFeatures }) => [...rootFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n rootFeatures: FeatureProviderServer<any, any, any>[]\n }) => FeatureProviderServer<any, any, any>[])\n | FeatureProviderServer<any, any, any>[]\n\ntype WithinEditorArgs = {\n config: EditorConfig\n editor: LexicalEditor\n node: LexicalNode\n}\n\n/**\n *\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\nexport type NodeMapValue<TNode extends SerializedNodeBase = SerializedLexicalNode> = {\n /**\n * Provide a react component to render the node.\n *\n * **JSX Converter:** Always works. Takes priority over `html`.\n *\n * **Lexical Editor:** Only works for DecoratorNodes (renders in `decorate` method). Takes priority over `html` and `createDOM`.\n */\n Component?: (\n args:\n | ({\n isEditor: false\n isJSXConverter: true\n } & JSXConverterArgs<TNode>)\n | ({\n isEditor: true\n isJSXConverter: false\n node: {\n _originalDecorate?: (editor: LexicalEditor, config: EditorConfig) => React.ReactNode\n } & DecoratorNode<React.ReactNode>\n } & Omit<WithinEditorArgs, 'node'>),\n ) => React.ReactNode\n /**\n * Provide a function to create the DOM element for the node.\n *\n * **JSX Converter:** Not used (only `Component` and `html` work).\n *\n * **Lexical Editor:** Always works (renders in `createDOM` method).\n * - For ElementNodes: This is the standard way to customize rendering.\n * - For DecoratorNodes: When combined with `html`, the DOM gets custom structure while `decorate` renders the `html` content.\n */\n createDOM?: (args: WithinEditorArgs) => HTMLElement\n /**\n * Provide HTML string or function to render the node.\n *\n * **JSX Converter:** Always works (ignored if `Component` is provided).\n *\n * **Lexical Editor behavior depends on node type:**\n *\n * - **ElementNodes:** `html` is used in `createDOM` to generate the DOM structure.\n *\n * - **DecoratorNodes (have both `createDOM` and `decorate`):**\n * - If only `html` is provided: `createDOM` uses `html` to create DOM, `decorate` returns `null`\n * - If `html` + `Component`: `createDOM` uses `html`, `decorate` uses `Component`\n * - If `html` + `createDOM`: Custom `createDOM` creates structure, `decorate` renders `html` content\n * - If `html` + `Component` + `createDOM`: Custom `createDOM` creates structure, `decorate` uses `Component` (html ignored in editor)\n */\n html?: (\n args:\n | ({\n isEditor: false\n isJSXConverter: true\n } & JSXConverterArgs<TNode>)\n | ({\n isEditor: true\n isJSXConverter: false\n } & WithinEditorArgs),\n ) => string\n}\n\ntype SharedViewMapBlockEditorProps<TNode extends SerializedBlockNode | SerializedInlineBlockNode> =\n {\n /**\n * True when rendering in the admin editor.\n */\n isEditor: true\n /**\n * False when rendering in the admin editor.\n */\n isJSXConverter: false\n } & Pick<BlockComponentProps<TNode['fields']>, 'className' | 'formData' | 'nodeKey'>\n\n/**\n * Props passed to a custom Block component in editor mode.\n * Use `isEditor` to discriminate between editor and JSX converter modes.\n *\n * @experimental - This API is experimental and may change in a minor release.\n */\nexport type ViewMapBlockEditorProps<TNode extends SerializedBlockNode> = {\n /**\n * Hook to access block UI components (BlockCollapsible, EditButton, etc.).\n * Call this inside your component to get the context values.\n * Passed as a prop so you don't need to import from @payloadcms/richtext-lexical/client.\n */\n useBlockComponentContext: () => BlockComponentContextType\n} & SharedViewMapBlockEditorProps<TNode>\n\n/**\n * Props passed to a custom Block component in editor mode.\n * Use `isEditor` to discriminate between editor and JSX converter modes.\n *\n * @experimental - This API is experimental and may change in a minor release.\n */\nexport type ViewMapInlineBlockEditorProps<TNode extends SerializedInlineBlockNode> = {\n useInlineBlockComponentContext: () => InlineBlockComponentContextType\n} & SharedViewMapBlockEditorProps<TNode>\n\n/**\n * Props passed to a custom Block component in JSX converter mode (frontend).\n * Use `isEditor` to discriminate between editor and JSX converter modes.\n *\n * @experimental - This API is experimental and may change in a minor release.\n */\nexport type ViewMapBlockJSXConverterProps<\n TNode extends SerializedBlockNode | SerializedInlineBlockNode =\n | SerializedBlockNode\n | SerializedInlineBlockNode,\n> = {\n /**\n * Index of this node among its siblings.\n */\n childIndex: number\n /**\n * Available JSX converters for nested content.\n */\n converters: JSXConverters\n /**\n * The block's form data (field values).\n */\n formData: TNode['fields']\n /**\n * False when rendering via JSX converter (frontend).\n */\n isEditor: false\n /**\n * True when rendering via JSX converter (frontend).\n */\n isJSXConverter: true\n /**\n * The serialized block node.\n */\n node: TNode\n /**\n * Function to convert child nodes to JSX.\n */\n nodesToJSX: (args: {\n converters?: JSXConverters\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n nodes: SerializedLexicalNode[]\n parent?: SerializedLexicalNodeWithParent\n }) => React.ReactNode[]\n /**\n * The parent node in the tree.\n */\n parent: SerializedLexicalNodeWithParent\n}\n\n/**\n * Props passed to a custom Block component in a view map.\n * This is a discriminated union - use `isEditor` to narrow the type.\n *\n * When `isEditor` is true, you're in the admin editor with access to `blockContext`.\n * When `isEditor` is false, you're in the frontend JSX converter with `nodesToJSX`.\n *\n * @example\n * ```tsx\n * const MyBlock: React.FC<ViewMapBlockComponentProps> = (props) => {\n * if (props.isEditor) {\n * // Admin editor - blockContext available\n * const { BlockCollapsible, EditButton } = props.blockContext\n * return <BlockCollapsible>{props.formData.title}</BlockCollapsible>\n * }\n * // Frontend - readonly render\n * return <div>{props.formData.title}</div>\n * }\n * ```\n *\n * @experimental - This API is experimental and may change in a minor release.\n */\nexport type ViewMapBlockComponentProps<TNode extends SerializedBlockNode = SerializedBlockNode> =\n | ViewMapBlockEditorProps<TNode>\n | ViewMapBlockJSXConverterProps<TNode>\n\nexport type ViewMapInlineBlockComponentProps<\n TNode extends SerializedInlineBlockNode = SerializedInlineBlockNode,\n> = ViewMapBlockJSXConverterProps<TNode> | ViewMapInlineBlockEditorProps<TNode>\n\n/**\n *\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\nexport type NodeMapBlockValue<TNode extends SerializedBlockNode = SerializedBlockNode> = {\n /**\n * A React component that replaces the entire block, including the header/collapsible.\n * Works for both admin editor and frontend JSX conversion.\n *\n * Use `isEditor` to discriminate between modes:\n * - Editor mode: `blockContext` is available with UI components (BlockCollapsible, EditButton, etc.)\n * - JSX converter mode: `nodesToJSX` is available for rendering nested content\n *\n * @example\n * ```tsx\n * Block: (props) => {\n * if (props.isEditor) {\n * const { BlockCollapsible } = props.blockContext\n * return <BlockCollapsible>{props.formData.title}</BlockCollapsible>\n * }\n * return <div>{props.formData.title}</div>\n * }\n * ```\n */\n Block?: React.FC<ViewMapBlockComponentProps<TNode>>\n /**\n * A React component that replaces the block label.\n * Use `useBlockComponentContext()` hook to access block context.\n */\n Label?: React.FC<ViewMapBlockComponentProps<TNode>>\n} & Pick<NodeMapValue<TNode>, 'Component' | 'createDOM' | 'html'>\n\nexport type NodeMapInlineBlockValue<\n TNode extends SerializedInlineBlockNode = SerializedInlineBlockNode,\n> = {\n /**\n * A React component that replaces the entire block, including the header/collapsible.\n * Works for both admin editor and frontend JSX conversion.\n *\n * Use `isEditor` to discriminate between modes:\n * - Editor mode: `blockContext` is available with UI components (BlockCollapsible, EditButton, etc.)\n * - JSX converter mode: `nodesToJSX` is available for rendering nested content\n *\n * @example\n * ```tsx\n * InlineBlock: (props) => {\n * if (props.isEditor) {\n * const { BlockCollapsible } = props.blockContext\n * return <BlockCollapsible>{props.formData.title}</BlockCollapsible>\n * }\n * return <div>{props.formData.title}</div>\n * }\n * ```\n */\n Block?: React.FC<ViewMapInlineBlockComponentProps<TNode>>\n /**\n * A React component that replaces the block label.\n * Use `useBlockComponentContext()` hook to access block context.\n */\n Label?: React.FC<ViewMapInlineBlockComponentProps<TNode>>\n} & Pick<NodeMapValue<TNode>, 'Component' | 'createDOM' | 'html'>\n\n/**\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\nexport type LexicalEditorNodeMap<\n TNodes extends SerializedNodeBase =\n | DefaultNodeTypes\n | SerializedBlockNode<{ blockName?: null | string; blockType: string }> // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n | SerializedInlineBlockNode<{ blockName?: null | string; blockType: string }>, // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n> = {\n // The index signature must include NodeMapBlockValue in the nested blockSlug mapping because\n // 'blocks' and 'inlineBlocks' properties use NodeMapBlockValue (which adds Block/Label props).\n // TypeScript requires that intersection properties be assignable to index signatures.\n [key: string]:\n | {\n [blockSlug: string]: NodeMapBlockValue<any> | NodeMapInlineBlockValue<any>\n }\n | NodeMapValue<any>\n | undefined\n} & {\n [nodeType in Exclude<NonNullable<TNodes['type']>, 'block' | 'inlineBlock'>]?: NodeMapValue<\n Extract<TNodes, { type: nodeType }>\n >\n} & {\n blocks?: {\n [K in (Extract<TNodes, { type: 'block' }> &\n SerializedBlockNode)['fields']['blockType']]?: NodeMapBlockValue<\n Extract<\n Extract<TNodes, { type: 'block' }> & SerializedBlockNode,\n { fields: { blockType: K } }\n >\n >\n }\n inlineBlocks?: {\n [K in (Extract<TNodes, { type: 'inlineBlock' }> &\n SerializedInlineBlockNode)['fields']['blockType']]?: NodeMapInlineBlockValue<\n Extract<\n Extract<TNodes, { type: 'inlineBlock' }> & SerializedInlineBlockNode,\n { fields: { blockType: K } }\n >\n >\n }\n unknown?: NodeMapValue<SerializedLexicalNode>\n}\n\n/**\n * A map of views, which can be used to render the editor in different ways.\n *\n * In order to override the default view, you can add a `default` key to the map.\n *\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\nexport type ClientFeaturesMap = {\n [featureKey: string]: {\n clientFeatureProps?: BaseClientFeatureProps<Record<string, any>>\n clientFeatureProvider?: FeatureProviderProviderClient<any, any>\n }\n}\n\nexport type LexicalEditorViewMap<\n TNodes extends SerializedNodeBase =\n | DefaultNodeTypes\n | SerializedBlockNode<{ blockName?: null | string; blockType: string }> // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n | SerializedInlineBlockNode<{ blockName?: null | string; blockType: string }>, // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n> = {\n [viewKey: string]: {\n admin?: LexicalFieldAdminClientProps\n /**\n * Transform the client features for this view.\n * Receives the full clientFeatures map and should return a (potentially modified) map.\n * Can be used to remove features or add new ones per-view.\n *\n * @example Remove toolbars\n * ```ts\n * filterFeatures: (features) => {\n * const { toolbarFixed, toolbarInline, ...rest } = features\n * return rest\n * }\n * ```\n */\n filterFeatures?: (clientFeatures: ClientFeaturesMap) => ClientFeaturesMap\n /**\n * Lexical editor configuration. Can be an object or a function that receives the default config.\n * Using a function avoids needing to import defaultEditorLexicalConfig.\n *\n * @example\n * ```ts\n * lexical: (defaultConfig) => ({\n * ...defaultConfig,\n * theme: { ...defaultConfig.theme, paragraph: 'my-paragraph' },\n * })\n * ```\n */\n lexical?: ((defaultConfig: LexicalEditorConfig) => LexicalEditorConfig) | LexicalEditorConfig\n nodes: LexicalEditorNodeMap<TNodes>\n }\n}\n\n/**\n * @todo rename to LexicalEditorArgs in 4.0, since these are arguments for the lexicalEditor function\n */\nexport type LexicalEditorProps = {\n admin?: LexicalFieldAdminProps\n features?: FeaturesInput\n lexical?: LexicalEditorConfig\n /**\n * A path to a LexicalEditorViewMap, which can be used to render the editor in different ways.\n *\n * In order to override the default view, you can add a `default` key to the map.\n *\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\n views?: PayloadComponent\n}\n\nexport type LexicalRichTextAdapter = {\n editorConfig: SanitizedServerEditorConfig\n features: FeatureProviderServer<any, any, any>[]\n} & RichTextAdapter<SerializedEditorState, AdapterProps>\n\nexport type LexicalRichTextAdapterProvider =\n /**\n * This is being called during the payload sanitization process\n */\n ({\n config,\n isRoot,\n parentIsLocalized,\n }: {\n config: SanitizedConfig\n isRoot?: boolean\n parentIsLocalized: boolean\n }) => LexicalRichTextAdapter\n\nexport type SingleFeatureClientSchemaMap = {\n [key: string]: ClientField[]\n}\nexport type FeatureClientSchemaMap = {\n [featureKey: string]: SingleFeatureClientSchemaMap\n}\n\nexport type LexicalRichTextFieldProps = {\n admin?: LexicalFieldAdminClientProps\n // clientFeatures is added through the rsc field\n clientFeatures: ClientFeaturesMap\n /**\n * Part of the import map that contains client components for all lexical features of this field that\n * have been added through `feature.componentImports`.\n */\n featureClientImportMap?: Record<string, any>\n featureClientSchemaMap: FeatureClientSchemaMap\n initialLexicalFormState?: InitialLexicalFormState\n lexicalEditorConfig?: LexicalEditorConfig // Undefined if default lexical editor config should be used\n views?: LexicalEditorViewMap\n} & Pick<ServerFieldBase, 'permissions'> &\n RichTextFieldClientProps<SerializedEditorState, AdapterProps, object>\n\nexport type LexicalRichTextCellProps = DefaultServerCellComponentProps<\n RichTextFieldClient<SerializedEditorState, AdapterProps, object>,\n SerializedEditorState\n>\n\nexport type AdapterProps = {\n editorConfig: SanitizedServerEditorConfig\n}\n\nexport type GeneratedFeatureProviderComponent = {\n clientFeature: FeatureProviderProviderClient<any, any>\n clientFeatureProps: BaseClientFeatureProps<object>\n}\n\nexport type LexicalRichTextField = RichTextField<SerializedEditorState, AdapterProps>\n"],"mappings":"AAyhBA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/types/index.ts"],"sourcesContent":["import type {\n DecoratorNode,\n EditorConfig,\n LexicalEditor,\n EditorConfig as LexicalEditorConfig,\n LexicalNode,\n SerializedEditorState,\n SerializedLexicalNode,\n} from 'lexical'\nimport type {\n ClientField,\n DefaultServerCellComponentProps,\n LabelFunction,\n MarkdownRichTextAdapter,\n PayloadComponent,\n RichTextField,\n RichTextFieldClient,\n RichTextFieldClientProps,\n SanitizedConfig,\n ServerFieldBase,\n StaticLabel,\n} from 'payload'\n\nimport type { BlockComponentContextType } from '../features/blocks/client/component/BlockContent.js'\nexport type { BlockComponentContextType }\nimport type { BlockComponentProps } from '../features/blocks/client/component/index.js'\nimport type { InlineBlockComponentContextType } from '../features/blocks/client/componentInline/index.js'\nimport type {\n JSXConverterArgs,\n JSXConverters,\n SerializedLexicalNodeWithParent,\n} from '../features/converters/lexicalToJSX/converter/types.js'\nimport type {\n BaseClientFeatureProps,\n FeatureProviderProviderClient,\n} from '../features/typesClient.js'\nimport type { FeatureProviderServer } from '../features/typesServer.js'\nimport type { SanitizedServerEditorConfig } from '../lexical/config/types.js'\nimport type { InitialLexicalFormState } from '../utilities/buildInitialState.js'\nimport type {\n DefaultNodeTypes,\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from './nodeTypes.js'\n\n/**\n * Base constraint for serialized Lexical node types.\n * Used as the generic constraint for node map types.\n * Extends the base SerializedLexicalNode with optional type for flexibility.\n */\nexport type SerializedNodeBase = { type?: string }\n\nexport type LexicalFieldAdminProps = {\n /**\n * Controls if the add block button should be hidden. @default false\n */\n hideAddBlockButton?: boolean\n /**\n * Controls if the draggable block element should be hidden. @default false\n */\n hideDraggableBlockElement?: boolean\n /**\n * Controls if the gutter (padding to the left & gray vertical line) should be hidden. @default false\n */\n hideGutter?: boolean\n /**\n * Controls if the insert paragraph at the end button should be hidden. @default false\n */\n hideInsertParagraphAtEnd?: boolean\n /**\n * Changes the placeholder text in the editor if no content is present.\n */\n placeholder?: LabelFunction | StaticLabel\n}\n\nexport type LexicalFieldAdminClientProps = {\n placeholder?: string\n} & Omit<LexicalFieldAdminProps, 'placeholder'>\n\nexport type FeaturesInput =\n | (({\n defaultFeatures,\n rootFeatures,\n }: {\n /**\n * This opinionated array contains all \"recommended\" default features.\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ defaultFeatures }) => [...defaultFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n defaultFeatures: FeatureProviderServer<any, any, any>[]\n /**\n * This array contains all features that are enabled in the root richText editor (the one defined in the payload.config.ts).\n * If this field is the root richText editor, or if the root richText editor is not a lexical editor, this array will be empty.\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ rootFeatures }) => [...rootFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n rootFeatures: FeatureProviderServer<any, any, any>[]\n }) => FeatureProviderServer<any, any, any>[])\n | FeatureProviderServer<any, any, any>[]\n\ntype WithinEditorArgs = {\n config: EditorConfig\n editor: LexicalEditor\n node: LexicalNode\n}\n\n/**\n *\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\nexport type NodeMapValue<TNode extends SerializedNodeBase = SerializedLexicalNode> = {\n /**\n * Provide a react component to render the node.\n *\n * **JSX Converter:** Always works. Takes priority over `html`.\n *\n * **Lexical Editor:** Only works for DecoratorNodes (renders in `decorate` method). Takes priority over `html` and `createDOM`.\n */\n Component?: (\n args:\n | ({\n isEditor: false\n isJSXConverter: true\n } & JSXConverterArgs<TNode>)\n | ({\n isEditor: true\n isJSXConverter: false\n node: {\n _originalDecorate?: (editor: LexicalEditor, config: EditorConfig) => React.ReactNode\n } & DecoratorNode<React.ReactNode>\n } & Omit<WithinEditorArgs, 'node'>),\n ) => React.ReactNode\n /**\n * Provide a function to create the DOM element for the node.\n *\n * **JSX Converter:** Not used (only `Component` and `html` work).\n *\n * **Lexical Editor:** Always works (renders in `createDOM` method).\n * - For ElementNodes: This is the standard way to customize rendering.\n * - For DecoratorNodes: When combined with `html`, the DOM gets custom structure while `decorate` renders the `html` content.\n */\n createDOM?: (args: WithinEditorArgs) => HTMLElement\n /**\n * Provide HTML string or function to render the node.\n *\n * **JSX Converter:** Always works (ignored if `Component` is provided).\n *\n * **Lexical Editor behavior depends on node type:**\n *\n * - **ElementNodes:** `html` is used in `createDOM` to generate the DOM structure.\n *\n * - **DecoratorNodes (have both `createDOM` and `decorate`):**\n * - If only `html` is provided: `createDOM` uses `html` to create DOM, `decorate` returns `null`\n * - If `html` + `Component`: `createDOM` uses `html`, `decorate` uses `Component`\n * - If `html` + `createDOM`: Custom `createDOM` creates structure, `decorate` renders `html` content\n * - If `html` + `Component` + `createDOM`: Custom `createDOM` creates structure, `decorate` uses `Component` (html ignored in editor)\n */\n html?: (\n args:\n | ({\n isEditor: false\n isJSXConverter: true\n } & JSXConverterArgs<TNode>)\n | ({\n isEditor: true\n isJSXConverter: false\n } & WithinEditorArgs),\n ) => string\n}\n\ntype SharedViewMapBlockEditorProps<TNode extends SerializedBlockNode | SerializedInlineBlockNode> =\n {\n /**\n * True when rendering in the admin editor.\n */\n isEditor: true\n /**\n * False when rendering in the admin editor.\n */\n isJSXConverter: false\n } & Pick<BlockComponentProps<TNode['fields']>, 'className' | 'formData' | 'nodeKey'>\n\n/**\n * Props passed to a custom Block component in editor mode.\n * Use `isEditor` to discriminate between editor and JSX converter modes.\n *\n * @experimental - This API is experimental and may change in a minor release.\n */\nexport type ViewMapBlockEditorProps<TNode extends SerializedBlockNode> = {\n /**\n * Hook to access block UI components (BlockCollapsible, EditButton, etc.).\n * Call this inside your component to get the context values.\n * Passed as a prop so you don't need to import from @payloadcms/richtext-lexical/client.\n */\n useBlockComponentContext: () => BlockComponentContextType\n} & SharedViewMapBlockEditorProps<TNode>\n\n/**\n * Props passed to a custom Block component in editor mode.\n * Use `isEditor` to discriminate between editor and JSX converter modes.\n *\n * @experimental - This API is experimental and may change in a minor release.\n */\nexport type ViewMapInlineBlockEditorProps<TNode extends SerializedInlineBlockNode> = {\n useInlineBlockComponentContext: () => InlineBlockComponentContextType\n} & SharedViewMapBlockEditorProps<TNode>\n\n/**\n * Props passed to a custom Block component in JSX converter mode (frontend).\n * Use `isEditor` to discriminate between editor and JSX converter modes.\n *\n * @experimental - This API is experimental and may change in a minor release.\n */\nexport type ViewMapBlockJSXConverterProps<\n TNode extends SerializedBlockNode | SerializedInlineBlockNode =\n | SerializedBlockNode\n | SerializedInlineBlockNode,\n> = {\n /**\n * Index of this node among its siblings.\n */\n childIndex: number\n /**\n * Available JSX converters for nested content.\n */\n converters: JSXConverters\n /**\n * The block's form data (field values).\n */\n formData: TNode['fields']\n /**\n * False when rendering via JSX converter (frontend).\n */\n isEditor: false\n /**\n * True when rendering via JSX converter (frontend).\n */\n isJSXConverter: true\n /**\n * The serialized block node.\n */\n node: TNode\n /**\n * Function to convert child nodes to JSX.\n */\n nodesToJSX: (args: {\n converters?: JSXConverters\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n nodes: SerializedLexicalNode[]\n parent?: SerializedLexicalNodeWithParent\n }) => React.ReactNode[]\n /**\n * The parent node in the tree.\n */\n parent: SerializedLexicalNodeWithParent\n}\n\n/**\n * Props passed to a custom Block component in a view map.\n * This is a discriminated union - use `isEditor` to narrow the type.\n *\n * When `isEditor` is true, you're in the admin editor with access to `blockContext`.\n * When `isEditor` is false, you're in the frontend JSX converter with `nodesToJSX`.\n *\n * @example\n * ```tsx\n * const MyBlock: React.FC<ViewMapBlockComponentProps> = (props) => {\n * if (props.isEditor) {\n * // Admin editor - blockContext available\n * const { BlockCollapsible, EditButton } = props.blockContext\n * return <BlockCollapsible>{props.formData.title}</BlockCollapsible>\n * }\n * // Frontend - readonly render\n * return <div>{props.formData.title}</div>\n * }\n * ```\n *\n * @experimental - This API is experimental and may change in a minor release.\n */\nexport type ViewMapBlockComponentProps<TNode extends SerializedBlockNode = SerializedBlockNode> =\n | ViewMapBlockEditorProps<TNode>\n | ViewMapBlockJSXConverterProps<TNode>\n\nexport type ViewMapInlineBlockComponentProps<\n TNode extends SerializedInlineBlockNode = SerializedInlineBlockNode,\n> = ViewMapBlockJSXConverterProps<TNode> | ViewMapInlineBlockEditorProps<TNode>\n\n/**\n *\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\nexport type NodeMapBlockValue<TNode extends SerializedBlockNode = SerializedBlockNode> = {\n /**\n * A React component that replaces the entire block, including the header/collapsible.\n * Works for both admin editor and frontend JSX conversion.\n *\n * Use `isEditor` to discriminate between modes:\n * - Editor mode: `blockContext` is available with UI components (BlockCollapsible, EditButton, etc.)\n * - JSX converter mode: `nodesToJSX` is available for rendering nested content\n *\n * @example\n * ```tsx\n * Block: (props) => {\n * if (props.isEditor) {\n * const { BlockCollapsible } = props.blockContext\n * return <BlockCollapsible>{props.formData.title}</BlockCollapsible>\n * }\n * return <div>{props.formData.title}</div>\n * }\n * ```\n */\n Block?: React.FC<ViewMapBlockComponentProps<TNode>>\n /**\n * A React component that replaces the block label.\n * Use `useBlockComponentContext()` hook to access block context.\n */\n Label?: React.FC<ViewMapBlockComponentProps<TNode>>\n} & Pick<NodeMapValue<TNode>, 'Component' | 'createDOM' | 'html'>\n\nexport type NodeMapInlineBlockValue<\n TNode extends SerializedInlineBlockNode = SerializedInlineBlockNode,\n> = {\n /**\n * A React component that replaces the entire block, including the header/collapsible.\n * Works for both admin editor and frontend JSX conversion.\n *\n * Use `isEditor` to discriminate between modes:\n * - Editor mode: `blockContext` is available with UI components (BlockCollapsible, EditButton, etc.)\n * - JSX converter mode: `nodesToJSX` is available for rendering nested content\n *\n * @example\n * ```tsx\n * InlineBlock: (props) => {\n * if (props.isEditor) {\n * const { BlockCollapsible } = props.blockContext\n * return <BlockCollapsible>{props.formData.title}</BlockCollapsible>\n * }\n * return <div>{props.formData.title}</div>\n * }\n * ```\n */\n Block?: React.FC<ViewMapInlineBlockComponentProps<TNode>>\n /**\n * A React component that replaces the block label.\n * Use `useBlockComponentContext()` hook to access block context.\n */\n Label?: React.FC<ViewMapInlineBlockComponentProps<TNode>>\n} & Pick<NodeMapValue<TNode>, 'Component' | 'createDOM' | 'html'>\n\n/**\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\nexport type LexicalEditorNodeMap<\n TNodes extends SerializedNodeBase =\n | DefaultNodeTypes\n | SerializedBlockNode<{ blockName?: null | string; blockType: string }> // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n | SerializedInlineBlockNode<{ blockName?: null | string; blockType: string }>, // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n> = {\n // The index signature must include NodeMapBlockValue in the nested blockSlug mapping because\n // 'blocks' and 'inlineBlocks' properties use NodeMapBlockValue (which adds Block/Label props).\n // TypeScript requires that intersection properties be assignable to index signatures.\n [key: string]:\n | {\n [blockSlug: string]: NodeMapBlockValue<any> | NodeMapInlineBlockValue<any>\n }\n | NodeMapValue<any>\n | undefined\n} & {\n [nodeType in Exclude<NonNullable<TNodes['type']>, 'block' | 'inlineBlock'>]?: NodeMapValue<\n Extract<TNodes, { type: nodeType }>\n >\n} & {\n blocks?: {\n [K in (Extract<TNodes, { type: 'block' }> &\n SerializedBlockNode)['fields']['blockType']]?: NodeMapBlockValue<\n Extract<\n Extract<TNodes, { type: 'block' }> & SerializedBlockNode,\n { fields: { blockType: K } }\n >\n >\n }\n inlineBlocks?: {\n [K in (Extract<TNodes, { type: 'inlineBlock' }> &\n SerializedInlineBlockNode)['fields']['blockType']]?: NodeMapInlineBlockValue<\n Extract<\n Extract<TNodes, { type: 'inlineBlock' }> & SerializedInlineBlockNode,\n { fields: { blockType: K } }\n >\n >\n }\n unknown?: NodeMapValue<SerializedLexicalNode>\n}\n\n/**\n * A map of views, which can be used to render the editor in different ways.\n *\n * In order to override the default view, you can add a `default` key to the map.\n *\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\nexport type ClientFeaturesMap = {\n [featureKey: string]: {\n clientFeatureProps?: BaseClientFeatureProps<Record<string, any>>\n clientFeatureProvider?: FeatureProviderProviderClient<any, any>\n }\n}\n\nexport type LexicalEditorViewMap<\n TNodes extends SerializedNodeBase =\n | DefaultNodeTypes\n | SerializedBlockNode<{ blockName?: null | string; blockType: string }> // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n | SerializedInlineBlockNode<{ blockName?: null | string; blockType: string }>, // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n> = {\n [viewKey: string]: {\n admin?: LexicalFieldAdminClientProps\n /**\n * Transform the client features for this view.\n * Receives the full clientFeatures map and should return a (potentially modified) map.\n * Can be used to remove features or add new ones per-view.\n *\n * @example Remove toolbars\n * ```ts\n * filterFeatures: (features) => {\n * const { toolbarFixed, toolbarInline, ...rest } = features\n * return rest\n * }\n * ```\n */\n filterFeatures?: (clientFeatures: ClientFeaturesMap) => ClientFeaturesMap\n /**\n * Lexical editor configuration. Can be an object or a function that receives the default config.\n * Using a function avoids needing to import defaultEditorLexicalConfig.\n *\n * @example\n * ```ts\n * lexical: (defaultConfig) => ({\n * ...defaultConfig,\n * theme: { ...defaultConfig.theme, paragraph: 'my-paragraph' },\n * })\n * ```\n */\n lexical?: ((defaultConfig: LexicalEditorConfig) => LexicalEditorConfig) | LexicalEditorConfig\n nodes: LexicalEditorNodeMap<TNodes>\n }\n}\n\nexport type LexicalEditorArgs = {\n admin?: LexicalFieldAdminProps\n features?: FeaturesInput\n lexical?: LexicalEditorConfig\n /**\n * A path to a LexicalEditorViewMap, which can be used to render the editor in different ways.\n *\n * In order to override the default view, you can add a `default` key to the map.\n *\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\n views?: PayloadComponent\n}\n\nexport type LexicalRichTextAdapter = {\n editorConfig: SanitizedServerEditorConfig\n features: FeatureProviderServer<any, any, any>[]\n} & MarkdownRichTextAdapter<SerializedEditorState, AdapterProps>\n\nexport type LexicalRichTextAdapterProvider =\n /**\n * This is being called during the payload sanitization process\n */\n ({\n config,\n isRoot,\n parentIsLocalized,\n }: {\n config: SanitizedConfig\n isRoot?: boolean\n parentIsLocalized: boolean\n }) => LexicalRichTextAdapter\n\nexport type SingleFeatureClientSchemaMap = {\n [key: string]: ClientField[]\n}\nexport type FeatureClientSchemaMap = {\n [featureKey: string]: SingleFeatureClientSchemaMap\n}\n\nexport type LexicalRichTextFieldProps = {\n admin?: LexicalFieldAdminClientProps\n // clientFeatures is added through the rsc field\n clientFeatures: ClientFeaturesMap\n /**\n * Part of the import map that contains client components for all lexical features of this field that\n * have been added through `feature.componentImports`.\n */\n featureClientImportMap?: Record<string, any>\n featureClientSchemaMap: FeatureClientSchemaMap\n initialLexicalFormState?: InitialLexicalFormState\n lexicalEditorConfig?: LexicalEditorConfig // Undefined if default lexical editor config should be used\n views?: LexicalEditorViewMap\n} & Pick<ServerFieldBase, 'permissions'> &\n RichTextFieldClientProps<SerializedEditorState, AdapterProps, object>\n\nexport type LexicalRichTextCellProps = DefaultServerCellComponentProps<\n RichTextFieldClient<SerializedEditorState, AdapterProps, object>,\n SerializedEditorState\n>\n\nexport type AdapterProps = {\n editorConfig: SanitizedServerEditorConfig\n}\n\nexport type GeneratedFeatureProviderComponent = {\n clientFeature: FeatureProviderProviderClient<any, any>\n clientFeatureProps: BaseClientFeatureProps<object>\n}\n\nexport type LexicalRichTextField = RichTextField<SerializedEditorState, AdapterProps>\n"],"mappings":"AAshBA","ignoreList":[]}
@@ -3,7 +3,11 @@ import type { JSONSchema4 } from 'json-schema';
3
3
  export declare const formatSchema: JSONSchema4;
4
4
  /** `direction` property shared by every element node. */
5
5
  export declare const directionSchema: JSONSchema4;
6
- /** `version` property shared by every Lexical node. */
6
+ /**
7
+ * `version` property shared by every Lexical node. Lexical deprecated it and ignores it when it
8
+ * loads a document. It stays optional so existing documents remain valid input, and `deprecated`
9
+ * hides it from the schema shown to agents (see `sanitizeEntitySchema` in `payload`).
10
+ */
7
11
  export declare const versionSchema: JSONSchema4;
8
12
  type ElementNodeSchemaOptions = {
9
13
  nodeType: string;
@@ -1 +1 @@
1
- {"version":3,"file":"jsonSchemaHelpers.d.ts","sourceRoot":"","sources":["../../src/types/jsonSchemaHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,oFAAoF;AACpF,eAAO,MAAM,YAAY,EAAE,WAK1B,CAAA;AAED,yDAAyD;AACzD,eAAO,MAAM,eAAe,EAAE,WAG7B,CAAA;AAED,uDAAuD;AACvD,eAAO,MAAM,aAAa,EAAE,WAG3B,CAAA;AAED,KAAK,wBAAwB,GAAG;IAC9B,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,WAAW,CAAA;KAAE,CAAA;IACzC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,8DAM3B;IAAE,YAAY,EAAE,WAAW,CAAA;CAAE,GAAG,wBAAwB,KAAG,WAc5D,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,IAAI,EAAE,wBAAwB,KAAK,WAAW,CAAA"}
1
+ {"version":3,"file":"jsonSchemaHelpers.d.ts","sourceRoot":"","sources":["../../src/types/jsonSchemaHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,oFAAoF;AACpF,eAAO,MAAM,YAAY,EAAE,WAK1B,CAAA;AAED,yDAAyD;AACzD,eAAO,MAAM,eAAe,EAAE,WAG7B,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,WAI3B,CAAA;AAED,KAAK,wBAAwB,GAAG;IAC9B,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,WAAW,CAAA;KAAE,CAAA;IACzC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,8DAM3B;IAAE,YAAY,EAAE,WAAW,CAAA;CAAE,GAAG,wBAAwB,KAAG,WAc5D,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,IAAI,EAAE,wBAAwB,KAAK,WAAW,CAAA"}
@@ -14,9 +14,14 @@ export const directionSchema = {
14
14
  }],
15
15
  tsType: 'LexicalElementDirection'
16
16
  };
17
- /** `version` property shared by every Lexical node. */
17
+ /**
18
+ * `version` property shared by every Lexical node. Lexical deprecated it and ignores it when it
19
+ * loads a document. It stays optional so existing documents remain valid input, and `deprecated`
20
+ * hides it from the schema shown to agents (see `sanitizeEntitySchema` in `payload`).
21
+ */
18
22
  export const versionSchema = {
19
23
  type: 'integer',
24
+ deprecated: true,
20
25
  description: "Lexical's internal serialization version for this node type."
21
26
  };
22
27
  /**
@@ -50,7 +55,7 @@ export const elementNodeSchema = ({
50
55
  version: versionSchema,
51
56
  ...properties
52
57
  },
53
- required: ['children', 'direction', 'format', 'indent', 'type', 'version', ...required],
58
+ required: ['children', 'direction', 'format', 'indent', 'type', ...required],
54
59
  ...(tsType ? {
55
60
  tsType
56
61
  } : {})
@@ -1 +1 @@
1
- {"version":3,"file":"jsonSchemaHelpers.js","names":["formatSchema","type","description","enum","tsType","directionSchema","oneOf","versionSchema","elementNodeSchema","nodeType","nodeUnionRef","properties","required","additionalProperties","const","children","items","direction","format","indent","version"],"sources":["../../src/types/jsonSchemaHelpers.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\n\n/** `format` property shared by every element node (Lexical `ElementFormatType`). */\nexport const formatSchema: JSONSchema4 = {\n type: 'string',\n description: 'How this element is aligned. Empty string means no explicit alignment.',\n enum: ['left', 'start', 'center', 'right', 'end', 'justify', ''],\n tsType: 'LexicalElementFormat',\n}\n\n/** `direction` property shared by every element node. */\nexport const directionSchema: JSONSchema4 = {\n oneOf: [{ type: 'string', enum: ['ltr', 'rtl'] }, { type: 'null' }],\n tsType: 'LexicalElementDirection',\n}\n\n/** `version` property shared by every Lexical node. */\nexport const versionSchema: JSONSchema4 = {\n type: 'integer',\n description: \"Lexical's internal serialization version for this node type.\",\n}\n\ntype ElementNodeSchemaOptions = {\n nodeType: string\n properties?: { [k: string]: JSONSchema4 }\n required?: string[]\n /** TS helper-type expression — emitted verbatim by json-schema-to-typescript. */\n tsType?: string\n}\n\n/**\n * Builds the JSON Schema for a Lexical element node - merges the shared\n * element-base shape (children/direction/format/indent/version) with the\n * node-specific bits a feature provides.\n */\nexport const elementNodeSchema = ({\n nodeType,\n nodeUnionRef,\n properties = {},\n required = [],\n tsType,\n}: { nodeUnionRef: JSONSchema4 } & ElementNodeSchemaOptions): JSONSchema4 => ({\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', const: nodeType },\n children: { type: 'array', items: nodeUnionRef },\n direction: directionSchema,\n format: formatSchema,\n indent: { type: 'integer' },\n version: versionSchema,\n ...properties,\n },\n required: ['children', 'direction', 'format', 'indent', 'type', 'version', ...required],\n ...(tsType ? { tsType } : {}),\n})\n\n/**\n * `elementNodeSchema` HOC type, so that features don't have to pass `nodeUnionRef` every time.\n */\nexport type ElementNodeSchemaFn = (opts: ElementNodeSchemaOptions) => JSONSchema4\n"],"mappings":"AAEA,oFACA,OAAO,MAAMA,YAAA,GAA4B;EACvCC,IAAA,EAAM;EACNC,WAAA,EAAa;EACbC,IAAA,EAAM,CAAC,QAAQ,SAAS,UAAU,SAAS,OAAO,WAAW,GAAG;EAChEC,MAAA,EAAQ;AACV;AAEA;AACA,OAAO,MAAMC,eAAA,GAA+B;EAC1CC,KAAA,EAAO,CAAC;IAAEL,IAAA,EAAM;IAAUE,IAAA,EAAM,CAAC,OAAO;EAAO,GAAG;IAAEF,IAAA,EAAM;EAAO,EAAE;EACnEG,MAAA,EAAQ;AACV;AAEA;AACA,OAAO,MAAMG,aAAA,GAA6B;EACxCN,IAAA,EAAM;EACNC,WAAA,EAAa;AACf;AAUA;;;;;AAKA,OAAO,MAAMM,iBAAA,GAAoBA,CAAC;EAChCC,QAAQ;EACRC,YAAY;EACZC,UAAA,GAAa,CAAC,CAAC;EACfC,QAAA,GAAW,EAAE;EACbR;AAAM,CACmD,MAAmB;EAC5EH,IAAA,EAAM;EACNY,oBAAA,EAAsB;EACtBF,UAAA,EAAY;IACVV,IAAA,EAAM;MAAEA,IAAA,EAAM;MAAUa,KAAA,EAAOL;IAAS;IACxCM,QAAA,EAAU;MAAEd,IAAA,EAAM;MAASe,KAAA,EAAON;IAAa;IAC/CO,SAAA,EAAWZ,eAAA;IACXa,MAAA,EAAQlB,YAAA;IACRmB,MAAA,EAAQ;MAAElB,IAAA,EAAM;IAAU;IAC1BmB,OAAA,EAASb,aAAA;IACT,GAAGI;EACL;EACAC,QAAA,EAAU,CAAC,YAAY,aAAa,UAAU,UAAU,QAAQ,W,GAAcA,QAAA,CAAS;EACvF,IAAIR,MAAA,GAAS;IAAEA;EAAO,IAAI,CAAC,CAAC;AAC9B","ignoreList":[]}
1
+ {"version":3,"file":"jsonSchemaHelpers.js","names":["formatSchema","type","description","enum","tsType","directionSchema","oneOf","versionSchema","deprecated","elementNodeSchema","nodeType","nodeUnionRef","properties","required","additionalProperties","const","children","items","direction","format","indent","version"],"sources":["../../src/types/jsonSchemaHelpers.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\n\n/** `format` property shared by every element node (Lexical `ElementFormatType`). */\nexport const formatSchema: JSONSchema4 = {\n type: 'string',\n description: 'How this element is aligned. Empty string means no explicit alignment.',\n enum: ['left', 'start', 'center', 'right', 'end', 'justify', ''],\n tsType: 'LexicalElementFormat',\n}\n\n/** `direction` property shared by every element node. */\nexport const directionSchema: JSONSchema4 = {\n oneOf: [{ type: 'string', enum: ['ltr', 'rtl'] }, { type: 'null' }],\n tsType: 'LexicalElementDirection',\n}\n\n/**\n * `version` property shared by every Lexical node. Lexical deprecated it and ignores it when it\n * loads a document. It stays optional so existing documents remain valid input, and `deprecated`\n * hides it from the schema shown to agents (see `sanitizeEntitySchema` in `payload`).\n */\nexport const versionSchema: JSONSchema4 = {\n type: 'integer',\n deprecated: true,\n description: \"Lexical's internal serialization version for this node type.\",\n}\n\ntype ElementNodeSchemaOptions = {\n nodeType: string\n properties?: { [k: string]: JSONSchema4 }\n required?: string[]\n /** TS helper-type expression — emitted verbatim by json-schema-to-typescript. */\n tsType?: string\n}\n\n/**\n * Builds the JSON Schema for a Lexical element node - merges the shared\n * element-base shape (children/direction/format/indent/version) with the\n * node-specific bits a feature provides.\n */\nexport const elementNodeSchema = ({\n nodeType,\n nodeUnionRef,\n properties = {},\n required = [],\n tsType,\n}: { nodeUnionRef: JSONSchema4 } & ElementNodeSchemaOptions): JSONSchema4 => ({\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', const: nodeType },\n children: { type: 'array', items: nodeUnionRef },\n direction: directionSchema,\n format: formatSchema,\n indent: { type: 'integer' },\n version: versionSchema,\n ...properties,\n },\n required: ['children', 'direction', 'format', 'indent', 'type', ...required],\n ...(tsType ? { tsType } : {}),\n})\n\n/**\n * `elementNodeSchema` HOC type, so that features don't have to pass `nodeUnionRef` every time.\n */\nexport type ElementNodeSchemaFn = (opts: ElementNodeSchemaOptions) => JSONSchema4\n"],"mappings":"AAEA,oFACA,OAAO,MAAMA,YAAA,GAA4B;EACvCC,IAAA,EAAM;EACNC,WAAA,EAAa;EACbC,IAAA,EAAM,CAAC,QAAQ,SAAS,UAAU,SAAS,OAAO,WAAW,GAAG;EAChEC,MAAA,EAAQ;AACV;AAEA;AACA,OAAO,MAAMC,eAAA,GAA+B;EAC1CC,KAAA,EAAO,CAAC;IAAEL,IAAA,EAAM;IAAUE,IAAA,EAAM,CAAC,OAAO;EAAO,GAAG;IAAEF,IAAA,EAAM;EAAO,EAAE;EACnEG,MAAA,EAAQ;AACV;AAEA;;;;;AAKA,OAAO,MAAMG,aAAA,GAA6B;EACxCN,IAAA,EAAM;EACNO,UAAA,EAAY;EACZN,WAAA,EAAa;AACf;AAUA;;;;;AAKA,OAAO,MAAMO,iBAAA,GAAoBA,CAAC;EAChCC,QAAQ;EACRC,YAAY;EACZC,UAAA,GAAa,CAAC,CAAC;EACfC,QAAA,GAAW,EAAE;EACbT;AAAM,CACmD,MAAmB;EAC5EH,IAAA,EAAM;EACNa,oBAAA,EAAsB;EACtBF,UAAA,EAAY;IACVX,IAAA,EAAM;MAAEA,IAAA,EAAM;MAAUc,KAAA,EAAOL;IAAS;IACxCM,QAAA,EAAU;MAAEf,IAAA,EAAM;MAASgB,KAAA,EAAON;IAAa;IAC/CO,SAAA,EAAWb,eAAA;IACXc,MAAA,EAAQnB,YAAA;IACRoB,MAAA,EAAQ;MAAEnB,IAAA,EAAM;IAAU;IAC1BoB,OAAA,EAASd,aAAA;IACT,GAAGK;EACL;EACAC,QAAA,EAAU,CAAC,YAAY,aAAa,UAAU,UAAU,Q,GAAWA,QAAA,CAAS;EAC5E,IAAIT,MAAA,GAAS;IAAEA;EAAO,IAAI,CAAC,CAAC;AAC9B","ignoreList":[]}
@@ -18,6 +18,7 @@ export interface SerializedLexicalElementBase<TChildren> {
18
18
  indent: number;
19
19
  textFormat?: number;
20
20
  textStyle?: string;
21
+ /** @deprecated Ignored when loading. Typed as required only to match Lexical's types: rich text sent through the API, CLI or MCP may not contain it. */
21
22
  version: number;
22
23
  }
23
24
  export type LexicalTextMode = 'normal' | 'segmented' | 'token';
@@ -28,6 +29,7 @@ export interface SerializedTextNode {
28
29
  style: string;
29
30
  text: string;
30
31
  type: 'text';
32
+ /** @deprecated Ignored when loading. Typed as required only to match Lexical's types: rich text sent through the API, CLI or MCP may not contain it. */
31
33
  version: number;
32
34
  }
33
35
  export interface SerializedTabNode {
@@ -37,10 +39,12 @@ export interface SerializedTabNode {
37
39
  style: string;
38
40
  text: string;
39
41
  type: 'tab';
42
+ /** @deprecated Ignored when loading. Typed as required only to match Lexical's types: rich text sent through the API, CLI or MCP may not contain it. */
40
43
  version: number;
41
44
  }
42
45
  export interface SerializedLineBreakNode {
43
46
  type: 'linebreak';
47
+ /** @deprecated Ignored when loading. Typed as required only to match Lexical's types: rich text sent through the API, CLI or MCP may not contain it. */
44
48
  version: number;
45
49
  }
46
50
  export interface SerializedParagraphNode<TChildren extends SerializedLexicalNode = SerializedLexicalNode> extends SerializedLexicalElementBase<TChildren> {
@@ -56,6 +60,7 @@ export interface LexicalRichText<TNode> {
56
60
  format: LexicalElementFormat;
57
61
  indent: number;
58
62
  type: 'root';
63
+ /** @deprecated Ignored when loading. Typed as required only to match Lexical's types: rich text sent through the API, CLI or MCP may not contain it. */
59
64
  version: number;
60
65
  };
61
66
  }
@@ -1 +1 @@
1
- {"version":3,"file":"nodeTypes.d.ts","sourceRoot":"","sources":["../../src/types/nodeTypes.ts"],"names":[],"mappings":"AAA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B,CAAC,kBAAkB,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC,CAAA;IAC/E,IAAI,EAAE,qBAAqB,CAAC,kBAAkB,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC,CAAA;IAC/E,QAAQ,EAAE,qBAAqB,CAAC,sBAAsB,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC,CAAA;IACvF,SAAS,EAAE,qBAAqB,CAAC,uBAAuB,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC,CAAA;IACzF,KAAK,EAAE,qBAAqB,CAAC,mBAAmB,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC,CAAA;IACjF,YAAY,EAAE,0BAA0B,CAAA;IACxC,GAAG,EAAE,iBAAiB,CAAA;IACtB,IAAI,EAAE,kBAAkB,CAAA;IACxB,MAAM,EAAE,oBAAoB,CAAA;CAC7B;AAED;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,CACjC,oBAAoB,SAAS,IAAI,GAAG,qBAAqB,GAAG,IAAI,IAC9D,gBAAgB,CAAC,gBAAgB,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"nodeTypes.js","names":[],"sources":["../../src/types/nodeTypes.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport type { SerializedQuoteNode } from '../features/blockquote/server/schema.js'\nimport type {\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from '../features/blocks/server/schema.js'\nimport type { SerializedHeadingNode } from '../features/heading/server/schema.js'\nimport type { SerializedHorizontalRuleNode } from '../features/horizontalRule/server/schema.js'\nimport type { SerializedAutoLinkNode, SerializedLinkNode } from '../features/link/server/schema.js'\nimport type { SerializedListItemNode, SerializedListNode } from '../features/lists/shared/schema.js'\nimport type { SerializedRelationshipNode } from '../features/relationship/server/schema.js'\nimport type {\n SerializedTableCellNode,\n SerializedTableNode,\n SerializedTableRowNode,\n} from '../features/table/server/schema.js'\nimport type { SerializedUploadNode } from '../features/upload/server/schema.js'\n\n// The declarations below must stay byte-for-byte aligned with the TS source\n// strings Payload appends to `payload-types.ts` — twins live in\n// `types/builtInNodes.ts` and per-feature `schema.ts`.\n\n/** @internal Core Lexical types — see @payloadcms/richtext-lexical. */\nexport type LexicalElementFormat = '' | 'center' | 'end' | 'justify' | 'left' | 'right' | 'start'\nexport type LexicalElementDirection = ('ltr' | 'rtl') | null\n\nexport interface SerializedLexicalElementBase<TChildren> {\n children: TChildren[]\n direction: LexicalElementDirection\n format: LexicalElementFormat\n indent: number\n textFormat?: number\n textStyle?: string\n version: number\n}\n\nexport type LexicalTextMode = 'normal' | 'segmented' | 'token'\n\nexport interface SerializedTextNode {\n detail: number\n format: number\n mode: LexicalTextMode\n style: string\n text: string\n type: 'text'\n version: number\n}\n\nexport interface SerializedTabNode {\n detail: number\n format: number\n mode: LexicalTextMode\n style: string\n text: string\n type: 'tab'\n version: number\n}\n\nexport interface SerializedLineBreakNode {\n type: 'linebreak'\n version: number\n}\n\nexport interface SerializedParagraphNode<\n TChildren extends SerializedLexicalNode = SerializedLexicalNode,\n> extends SerializedLexicalElementBase<TChildren> {\n textFormat: number\n textStyle: string\n type: 'paragraph'\n}\n\n/** Shape of a Lexical `richText` field. */\nexport interface LexicalRichText<TNode> {\n root: {\n children: TNode[]\n direction: LexicalElementDirection\n format: LexicalElementFormat\n indent: number\n type: 'root'\n version: number\n }\n}\n\nexport type {\n SerializedAutoLinkNode,\n SerializedBlockNode,\n SerializedHeadingNode,\n SerializedHorizontalRuleNode,\n SerializedInlineBlockNode,\n SerializedLinkNode,\n SerializedListItemNode,\n SerializedListNode,\n SerializedQuoteNode,\n SerializedRelationshipNode,\n SerializedTableCellNode,\n SerializedTableNode,\n SerializedTableRowNode,\n SerializedUploadNode,\n}\n\n/** `SerializedEditorState` with nodes narrowed by `type`. No type-casting needed. */\nexport type TypedEditorState<TNode extends SerializedLexicalNode = SerializedLexicalNode> =\n LexicalRichText<TNode>\n\n/**\n * The node union of a generated `richText` field. Pass the field type — e.g.\n * `RichTextNodes<Post['richText']>` — to type an individual node you build for that editor (for\n * example a single block, or a `.map()` of nodes). To build a whole editor state, prefer passing\n * the field type straight to {@link buildEditorState}.\n */\nexport type RichTextNodes<TRichText> =\n NonNullable<TRichText> extends LexicalRichText<infer TNode> ? TNode : never\n\n/**\n * All node types included by default in a lexical editor. Self-recursive —\n * each element node's `children` is `DefaultNodeTypes` again, no depth limit.\n * To compose your own union including the defaults, see {@link WithDefaultNodes}.\n */\nexport type DefaultNodeTypes =\n | SerializedAutoLinkNode<DefaultNodeTypes>\n //| SerializedBlockNode // Not included by default\n | SerializedHeadingNode<DefaultNodeTypes>\n | SerializedHorizontalRuleNode\n | SerializedLineBreakNode\n | SerializedLinkNode<DefaultNodeTypes>\n | SerializedListItemNode<DefaultNodeTypes>\n | SerializedListNode<DefaultNodeTypes>\n | SerializedParagraphNode<DefaultNodeTypes>\n | SerializedQuoteNode<DefaultNodeTypes>\n | SerializedRelationshipNode\n | SerializedTabNode\n | SerializedTextNode\n | SerializedUploadNode\n\n/**\n * The built-in lexical nodes, plus your own - with your nodes threaded into every container's\n * `children`, not just the top level. Pass your custom node(s) as the generic:\n *\n * ```ts\n * type MyNodes = WithDefaultNodes<SerializedBlockNode<MyBlockData>>\n * ```\n *\n * Built by flattening {@link DefaultNodeRegistry} (`Registry[keyof Registry]`); see that interface\n * for why the node set lives in a registry instead of being written as a plain union type.\n */\nexport type WithDefaultNodes<TCustom extends SerializedLexicalNode = never> =\n DefaultNodeRegistry<TCustom>[keyof DefaultNodeRegistry<TCustom>]\n\n/** @internal Re-types an element node's `children` to the recursive node union. */\ntype WithRecursiveChildren<TNode, TCustom extends SerializedLexicalNode> = {\n children: WithDefaultNodes<TCustom>[]\n} & Omit<TNode, 'children'>\n\n/**\n * @internal The set of default nodes, generic over the user's custom node(s). {@link WithDefaultNodes}\n * flattens it into the node union with `Registry[keyof Registry]`.\n *\n * Why a registry interface instead of writing the union directly? The union has to be self-referential:\n * every element node's `children` is the same node union (so custom nodes nest inside containers too).\n * A generic *type alias* can't reference itself that way - `type N<T> = SerializedParagraphNode<N<T>> | ...`\n * is a `TS2456` circular reference, because instantiating a type alias resolves its type argument\n * eagerly. An *interface* resolves its members lazily, so the self-reference inside `children: ...[]`\n * is allowed - the recursion is legal precisely because it lives inside this interface. Reusing the\n * real node interfaces (re-typing only `children`) keeps each entry in sync with its node's real shape.\n */\ninterface DefaultNodeRegistry<TCustom extends SerializedLexicalNode> {\n autolink: WithRecursiveChildren<SerializedAutoLinkNode<SerializedLexicalNode>, TCustom>\n custom: TCustom\n heading: WithRecursiveChildren<SerializedHeadingNode<SerializedLexicalNode>, TCustom>\n horizontalrule: SerializedHorizontalRuleNode\n linebreak: SerializedLineBreakNode\n link: WithRecursiveChildren<SerializedLinkNode<SerializedLexicalNode>, TCustom>\n list: WithRecursiveChildren<SerializedListNode<SerializedLexicalNode>, TCustom>\n listitem: WithRecursiveChildren<SerializedListItemNode<SerializedLexicalNode>, TCustom>\n paragraph: WithRecursiveChildren<SerializedParagraphNode<SerializedLexicalNode>, TCustom>\n quote: WithRecursiveChildren<SerializedQuoteNode<SerializedLexicalNode>, TCustom>\n relationship: SerializedRelationshipNode\n tab: SerializedTabNode\n text: SerializedTextNode\n upload: SerializedUploadNode\n}\n\n/**\n * Like `TypedEditorState`, but pre-filled with every default node type. Pass extra node types as a\n * generic to add your own; they're threaded into every container's `children` (via\n * {@link WithDefaultNodes}), not just allowed at the top level.\n */\nexport type DefaultTypedEditorState<\n TAdditionalNodeTypes extends null | SerializedLexicalNode = null,\n> = TypedEditorState<WithDefaultNodes<NonNullable<TAdditionalNodeTypes>>>\n"],"mappings":"AAuLA;;;;GAKA","ignoreList":[]}
1
+ {"version":3,"file":"nodeTypes.js","names":[],"sources":["../../src/types/nodeTypes.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport type { SerializedQuoteNode } from '../features/blockquote/server/schema.js'\nimport type {\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from '../features/blocks/server/schema.js'\nimport type { SerializedHeadingNode } from '../features/heading/server/schema.js'\nimport type { SerializedHorizontalRuleNode } from '../features/horizontalRule/server/schema.js'\nimport type { SerializedAutoLinkNode, SerializedLinkNode } from '../features/link/server/schema.js'\nimport type { SerializedListItemNode, SerializedListNode } from '../features/lists/shared/schema.js'\nimport type { SerializedRelationshipNode } from '../features/relationship/server/schema.js'\nimport type {\n SerializedTableCellNode,\n SerializedTableNode,\n SerializedTableRowNode,\n} from '../features/table/server/schema.js'\nimport type { SerializedUploadNode } from '../features/upload/server/schema.js'\n\n// The declarations below must stay byte-for-byte aligned with the TS source\n// strings Payload appends to `payload-types.ts` — twins live in\n// `types/builtInNodes.ts` and per-feature `schema.ts`.\n\n/** @internal Core Lexical types — see @payloadcms/richtext-lexical. */\nexport type LexicalElementFormat = '' | 'center' | 'end' | 'justify' | 'left' | 'right' | 'start'\nexport type LexicalElementDirection = ('ltr' | 'rtl') | null\n\nexport interface SerializedLexicalElementBase<TChildren> {\n children: TChildren[]\n direction: LexicalElementDirection\n format: LexicalElementFormat\n indent: number\n textFormat?: number\n textStyle?: string\n /** @deprecated Ignored when loading. Typed as required only to match Lexical's types: rich text sent through the API, CLI or MCP may not contain it. */\n version: number\n}\n\nexport type LexicalTextMode = 'normal' | 'segmented' | 'token'\n\nexport interface SerializedTextNode {\n detail: number\n format: number\n mode: LexicalTextMode\n style: string\n text: string\n type: 'text'\n /** @deprecated Ignored when loading. Typed as required only to match Lexical's types: rich text sent through the API, CLI or MCP may not contain it. */\n version: number\n}\n\nexport interface SerializedTabNode {\n detail: number\n format: number\n mode: LexicalTextMode\n style: string\n text: string\n type: 'tab'\n /** @deprecated Ignored when loading. Typed as required only to match Lexical's types: rich text sent through the API, CLI or MCP may not contain it. */\n version: number\n}\n\nexport interface SerializedLineBreakNode {\n type: 'linebreak'\n /** @deprecated Ignored when loading. Typed as required only to match Lexical's types: rich text sent through the API, CLI or MCP may not contain it. */\n version: number\n}\n\nexport interface SerializedParagraphNode<\n TChildren extends SerializedLexicalNode = SerializedLexicalNode,\n> extends SerializedLexicalElementBase<TChildren> {\n textFormat: number\n textStyle: string\n type: 'paragraph'\n}\n\n/** Shape of a Lexical `richText` field. */\nexport interface LexicalRichText<TNode> {\n root: {\n children: TNode[]\n direction: LexicalElementDirection\n format: LexicalElementFormat\n indent: number\n type: 'root'\n /** @deprecated Ignored when loading. Typed as required only to match Lexical's types: rich text sent through the API, CLI or MCP may not contain it. */\n version: number\n }\n}\n\nexport type {\n SerializedAutoLinkNode,\n SerializedBlockNode,\n SerializedHeadingNode,\n SerializedHorizontalRuleNode,\n SerializedInlineBlockNode,\n SerializedLinkNode,\n SerializedListItemNode,\n SerializedListNode,\n SerializedQuoteNode,\n SerializedRelationshipNode,\n SerializedTableCellNode,\n SerializedTableNode,\n SerializedTableRowNode,\n SerializedUploadNode,\n}\n\n/** `SerializedEditorState` with nodes narrowed by `type`. No type-casting needed. */\nexport type TypedEditorState<TNode extends SerializedLexicalNode = SerializedLexicalNode> =\n LexicalRichText<TNode>\n\n/**\n * The node union of a generated `richText` field. Pass the field type — e.g.\n * `RichTextNodes<Post['richText']>` — to type an individual node you build for that editor (for\n * example a single block, or a `.map()` of nodes). To build a whole editor state, prefer passing\n * the field type straight to {@link buildEditorState}.\n */\nexport type RichTextNodes<TRichText> =\n NonNullable<TRichText> extends LexicalRichText<infer TNode> ? TNode : never\n\n/**\n * All node types included by default in a lexical editor. Self-recursive —\n * each element node's `children` is `DefaultNodeTypes` again, no depth limit.\n * To compose your own union including the defaults, see {@link WithDefaultNodes}.\n */\nexport type DefaultNodeTypes =\n | SerializedAutoLinkNode<DefaultNodeTypes>\n //| SerializedBlockNode // Not included by default\n | SerializedHeadingNode<DefaultNodeTypes>\n | SerializedHorizontalRuleNode\n | SerializedLineBreakNode\n | SerializedLinkNode<DefaultNodeTypes>\n | SerializedListItemNode<DefaultNodeTypes>\n | SerializedListNode<DefaultNodeTypes>\n | SerializedParagraphNode<DefaultNodeTypes>\n | SerializedQuoteNode<DefaultNodeTypes>\n | SerializedRelationshipNode\n | SerializedTabNode\n | SerializedTextNode\n | SerializedUploadNode\n\n/**\n * The built-in lexical nodes, plus your own - with your nodes threaded into every container's\n * `children`, not just the top level. Pass your custom node(s) as the generic:\n *\n * ```ts\n * type MyNodes = WithDefaultNodes<SerializedBlockNode<MyBlockData>>\n * ```\n *\n * Built by flattening {@link DefaultNodeRegistry} (`Registry[keyof Registry]`); see that interface\n * for why the node set lives in a registry instead of being written as a plain union type.\n */\nexport type WithDefaultNodes<TCustom extends SerializedLexicalNode = never> =\n DefaultNodeRegistry<TCustom>[keyof DefaultNodeRegistry<TCustom>]\n\n/** @internal Re-types an element node's `children` to the recursive node union. */\ntype WithRecursiveChildren<TNode, TCustom extends SerializedLexicalNode> = {\n children: WithDefaultNodes<TCustom>[]\n} & Omit<TNode, 'children'>\n\n/**\n * @internal The set of default nodes, generic over the user's custom node(s). {@link WithDefaultNodes}\n * flattens it into the node union with `Registry[keyof Registry]`.\n *\n * Why a registry interface instead of writing the union directly? The union has to be self-referential:\n * every element node's `children` is the same node union (so custom nodes nest inside containers too).\n * A generic *type alias* can't reference itself that way - `type N<T> = SerializedParagraphNode<N<T>> | ...`\n * is a `TS2456` circular reference, because instantiating a type alias resolves its type argument\n * eagerly. An *interface* resolves its members lazily, so the self-reference inside `children: ...[]`\n * is allowed - the recursion is legal precisely because it lives inside this interface. Reusing the\n * real node interfaces (re-typing only `children`) keeps each entry in sync with its node's real shape.\n */\ninterface DefaultNodeRegistry<TCustom extends SerializedLexicalNode> {\n autolink: WithRecursiveChildren<SerializedAutoLinkNode<SerializedLexicalNode>, TCustom>\n custom: TCustom\n heading: WithRecursiveChildren<SerializedHeadingNode<SerializedLexicalNode>, TCustom>\n horizontalrule: SerializedHorizontalRuleNode\n linebreak: SerializedLineBreakNode\n link: WithRecursiveChildren<SerializedLinkNode<SerializedLexicalNode>, TCustom>\n list: WithRecursiveChildren<SerializedListNode<SerializedLexicalNode>, TCustom>\n listitem: WithRecursiveChildren<SerializedListItemNode<SerializedLexicalNode>, TCustom>\n paragraph: WithRecursiveChildren<SerializedParagraphNode<SerializedLexicalNode>, TCustom>\n quote: WithRecursiveChildren<SerializedQuoteNode<SerializedLexicalNode>, TCustom>\n relationship: SerializedRelationshipNode\n tab: SerializedTabNode\n text: SerializedTextNode\n upload: SerializedUploadNode\n}\n\n/**\n * Like `TypedEditorState`, but pre-filled with every default node type. Pass extra node types as a\n * generic to add your own; they're threaded into every container's `children` (via\n * {@link WithDefaultNodes}), not just allowed at the top level.\n */\nexport type DefaultTypedEditorState<\n TAdditionalNodeTypes extends null | SerializedLexicalNode = null,\n> = TypedEditorState<WithDefaultNodes<NonNullable<TAdditionalNodeTypes>>>\n"],"mappings":"AA4LA;;;;GAKA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import type { SerializedLexicalNode } from 'lexical';
2
- import type { ClientFieldSchemaMap, ComponentRenderer, DocumentPreferences, FieldSchemaMap, FormState, Operation, PayloadRequest, RichTextField, SanitizedFieldPermissions } from 'payload';
2
+ import type { ClientFieldSchemaMap, ComponentRenderer, DocumentPreferences, FieldOperation, FieldSchemaMap, FormState, PayloadRequest, RichTextField, SanitizedFieldPermissions } from 'payload';
3
3
  export type InitialLexicalFormState = {
4
4
  [nodeID: string]: {
5
5
  [key: string]: any;
@@ -17,7 +17,7 @@ type Props = {
17
17
  fieldSchemaMap: FieldSchemaMap;
18
18
  id?: number | string;
19
19
  lexicalFieldSchemaPath: string;
20
- operation: Operation;
20
+ operation: FieldOperation;
21
21
  permissions?: SanitizedFieldPermissions;
22
22
  preferences: DocumentPreferences;
23
23
  renderComponent: ComponentRenderer;
@@ -1 +1 @@
1
- {"version":3,"file":"buildInitialState.d.ts","sourceRoot":"","sources":["../../src/utilities/buildInitialState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,SAAS,EACT,SAAS,EACT,cAAc,EACd,aAAa,EACb,yBAAyB,EAC1B,MAAM,SAAS,CAAA;AAMhB,MAAM,MAAM,uBAAuB,GAAG;IACpC,CAAC,MAAM,EAAE,MAAM,GAAG;QAChB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;QAClB,SAAS,CAAC,EAAE,SAAS,CAAA;QACrB,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB,CAAA;CACF,CAAA;AAED,KAAK,KAAK,GAAG;IACX,OAAO,EAAE;QACP,oBAAoB,EAAE,oBAAoB,CAAA;QAC1C,cAAc,EAAE,MAAM,CAAA;QACtB,QAAQ,CAAC,EAAE,OAAO,CAAA;QAClB,YAAY,CAAC,EAAE,GAAG,CAAA;QAClB,KAAK,EAAE,aAAa,CAAA;QACpB,cAAc,EAAE,cAAc,CAAA;QAC9B,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;QACpB,sBAAsB,EAAE,MAAM,CAAA;QAC9B,SAAS,EAAE,SAAS,CAAA;QACpB,WAAW,CAAC,EAAE,yBAAyB,CAAA;QACvC,WAAW,EAAE,mBAAmB,CAAA;QAChC,eAAe,EAAE,iBAAiB,CAAA;QAClC,aAAa,EAAE,GAAG,CAAA;QAClB,GAAG,EAAE,cAAc,CAAA;KACpB,CAAA;IACD,YAAY,CAAC,EAAE,uBAAuB,CAAA;IACtC,QAAQ,EAAE,qBAAqB,EAAE,CAAA;CAClC,CAAA;AAED,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,YAAY,EAAE,oBAAoB,EAClC,QAAQ,GACT,EAAE,KAAK,GAAG,OAAO,CAAC,uBAAuB,CAAC,CA6D1C"}
1
+ {"version":3,"file":"buildInitialState.d.ts","sourceRoot":"","sources":["../../src/utilities/buildInitialState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,SAAS,EACT,cAAc,EACd,aAAa,EACb,yBAAyB,EAC1B,MAAM,SAAS,CAAA;AAMhB,MAAM,MAAM,uBAAuB,GAAG;IACpC,CAAC,MAAM,EAAE,MAAM,GAAG;QAChB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;QAClB,SAAS,CAAC,EAAE,SAAS,CAAA;QACrB,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB,CAAA;CACF,CAAA;AAED,KAAK,KAAK,GAAG;IACX,OAAO,EAAE;QACP,oBAAoB,EAAE,oBAAoB,CAAA;QAC1C,cAAc,EAAE,MAAM,CAAA;QACtB,QAAQ,CAAC,EAAE,OAAO,CAAA;QAClB,YAAY,CAAC,EAAE,GAAG,CAAA;QAClB,KAAK,EAAE,aAAa,CAAA;QACpB,cAAc,EAAE,cAAc,CAAA;QAC9B,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;QACpB,sBAAsB,EAAE,MAAM,CAAA;QAC9B,SAAS,EAAE,cAAc,CAAA;QACzB,WAAW,CAAC,EAAE,yBAAyB,CAAA;QACvC,WAAW,EAAE,mBAAmB,CAAA;QAChC,eAAe,EAAE,iBAAiB,CAAA;QAClC,aAAa,EAAE,GAAG,CAAA;QAClB,GAAG,EAAE,cAAc,CAAA;KACpB,CAAA;IACD,YAAY,CAAC,EAAE,uBAAuB,CAAA;IACtC,QAAQ,EAAE,qBAAqB,EAAE,CAAA;CAClC,CAAA;AAED,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,YAAY,EAAE,oBAAoB,EAClC,QAAQ,GACT,EAAE,KAAK,GAAG,OAAO,CAAC,uBAAuB,CAAC,CA6D1C"}
@@ -1 +1 @@
1
- {"version":3,"file":"buildInitialState.js","names":["fieldSchemasToFormState","buildInitialState","context","initialState","initialStateFromArgs","nodeData","node","children","type","blockNode","id","fields","schemaFieldsPath","lexicalFieldSchemaPath","blockType","formStateResult","clientFieldSchemaMap","collectionSlug","data","documentData","fieldSchemaMap","get","initialBlockData","operation","permissions","preferences","readOnly","disabled","renderAllFields","renderFieldFn","req","schemaPath","formState","currentFieldPreferences","field","name","collapsedArray","collapsed","Array","isArray","includes"],"sources":["../../src/utilities/buildInitialState.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\nimport type {\n ClientFieldSchemaMap,\n ComponentRenderer,\n DocumentPreferences,\n FieldSchemaMap,\n FormState,\n Operation,\n PayloadRequest,\n RichTextField,\n SanitizedFieldPermissions,\n} from 'payload'\n\nimport { fieldSchemasToFormState } from '@payloadcms/ui/forms/fieldSchemasToFormState'\n\nimport type { SerializedBlockNode } from '../types/nodeTypes.js'\n\nexport type InitialLexicalFormState = {\n [nodeID: string]: {\n [key: string]: any\n formState?: FormState\n schemaPath?: string\n }\n}\n\ntype Props = {\n context: {\n clientFieldSchemaMap: ClientFieldSchemaMap\n collectionSlug: string\n disabled?: boolean\n documentData?: any\n field: RichTextField\n fieldSchemaMap: FieldSchemaMap\n id?: number | string\n lexicalFieldSchemaPath: string\n operation: Operation\n permissions?: SanitizedFieldPermissions\n preferences: DocumentPreferences\n renderComponent: ComponentRenderer\n renderFieldFn: any\n req: PayloadRequest\n }\n initialState?: InitialLexicalFormState\n nodeData: SerializedLexicalNode[]\n}\n\nexport async function buildInitialState({\n context,\n initialState: initialStateFromArgs,\n nodeData,\n}: Props): Promise<InitialLexicalFormState> {\n let initialState: InitialLexicalFormState = initialStateFromArgs ?? {}\n for (const node of nodeData) {\n if ('children' in node) {\n initialState = await buildInitialState({\n context,\n initialState,\n nodeData: node.children as SerializedLexicalNode[],\n })\n }\n\n if (node.type === 'block' || node.type === 'inlineBlock') {\n const blockNode = node as SerializedBlockNode\n const id = blockNode?.fields?.id\n if (!id) {\n continue\n }\n\n const schemaFieldsPath =\n node.type === 'block'\n ? `${context.lexicalFieldSchemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockNode.fields.blockType}.fields`\n : `${context.lexicalFieldSchemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${blockNode.fields.blockType}.fields`\n\n // Build form state for the block\n\n const formStateResult = await fieldSchemasToFormState({\n id: context.id,\n clientFieldSchemaMap: context.clientFieldSchemaMap,\n collectionSlug: context.collectionSlug,\n data: blockNode.fields,\n documentData: context.documentData,\n fields: (context.fieldSchemaMap.get(schemaFieldsPath) as any)?.fields,\n fieldSchemaMap: context.fieldSchemaMap,\n initialBlockData: blockNode.fields,\n operation: context.operation as any, // TODO: Type\n permissions: true,\n preferences: context.preferences,\n readOnly: context.disabled,\n renderAllFields: true, // If this function runs, the parent lexical field is being re-rendered => thus we can assume all its sub-fields need to be re-rendered\n renderFieldFn: context.renderFieldFn,\n req: context.req,\n schemaPath: schemaFieldsPath,\n })\n\n if (!initialState[id]) {\n initialState[id] = {}\n }\n\n initialState[id].formState = formStateResult\n initialState[id].schemaPath = schemaFieldsPath\n\n if (node.type === 'block') {\n const currentFieldPreferences = context.preferences?.fields?.[context.field.name]\n const collapsedArray = currentFieldPreferences?.collapsed\n if (Array.isArray(collapsedArray) && collapsedArray.includes(id)) {\n initialState[id].collapsed = true\n }\n }\n }\n }\n return initialState\n}\n"],"mappings":"AAaA,SAASA,uBAAuB,QAAQ;AAiCxC,OAAO,eAAeC,kBAAkB;EACtCC,OAAO;EACPC,YAAA,EAAcC,oBAAoB;EAClCC;AAAQ,CACF;EACN,IAAIF,YAAA,GAAwCC,oBAAA,IAAwB,CAAC;EACrE,KAAK,MAAME,IAAA,IAAQD,QAAA,EAAU;IAC3B,IAAI,cAAcC,IAAA,EAAM;MACtBH,YAAA,GAAe,MAAMF,iBAAA,CAAkB;QACrCC,OAAA;QACAC,YAAA;QACAE,QAAA,EAAUC,IAAA,CAAKC;MACjB;IACF;IAEA,IAAID,IAAA,CAAKE,IAAI,KAAK,WAAWF,IAAA,CA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eAAA;MAC7BZ,YAAY,CAACO,EAAA,CAAG,CAACqB,UAAU,GAAGnB,gBAAA;MAE9B,IAAIN,IAAA,CAAKE,IAAI,KAAK,SAAS;QACzB,MAAMyB,uBAAA,GAA0B/B,OAAA,CAAQuB,WAAW,EAAEd,MAAA,GAAST,OAAA,CAAQgC,KAAK,CAACC,IAAI,CAAC;QACjF,MAAMC,cAAA,GAAiBH,uBAAA,EAAyBI,SAAA;QAChD,IAAIC,KAAA,CAAMC,OAAO,CAACH,cAAA,KAAmBA,cAAA,CAAeI,QAAQ,CAAC9B,EAAA,GAAK;UAChEP,YAAY,CAACO,EAAA,CAAG,CAAC2B,SAAS,GAAG;QAC/B;MACF;IACF;EACF;EACA,OAAOlC,YAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"buildInitialState.js","names":["fieldSchemasToFormState","buildInitialState","context","initialState","initialStateFromArgs","nodeData","node","children","type","blockNode","id","fields","schemaFieldsPath","lexicalFieldSchemaPath","blockType","formStateResult","clientFieldSchemaMap","collectionSlug","data","documentData","fieldSchemaMap","get","initialBlockData","operation","permissions","preferences","readOnly","disabled","renderAllFields","renderFieldFn","req","schemaPath","formState","currentFieldPreferences","field","name","collapsedArray","collapsed","Array","isArray","includes"],"sources":["../../src/utilities/buildInitialState.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\nimport type {\n ClientFieldSchemaMap,\n ComponentRenderer,\n DocumentPreferences,\n FieldOperation,\n FieldSchemaMap,\n FormState,\n PayloadRequest,\n RichTextField,\n SanitizedFieldPermissions,\n} from 'payload'\n\nimport { fieldSchemasToFormState } from '@payloadcms/ui/forms/fieldSchemasToFormState'\n\nimport type { SerializedBlockNode } from '../types/nodeTypes.js'\n\nexport type InitialLexicalFormState = {\n [nodeID: string]: {\n [key: string]: any\n formState?: FormState\n schemaPath?: string\n }\n}\n\ntype Props = {\n context: {\n clientFieldSchemaMap: ClientFieldSchemaMap\n collectionSlug: string\n disabled?: boolean\n documentData?: any\n field: RichTextField\n fieldSchemaMap: FieldSchemaMap\n id?: number | string\n lexicalFieldSchemaPath: string\n operation: FieldOperation\n permissions?: SanitizedFieldPermissions\n preferences: DocumentPreferences\n renderComponent: ComponentRenderer\n renderFieldFn: any\n req: PayloadRequest\n }\n initialState?: InitialLexicalFormState\n nodeData: SerializedLexicalNode[]\n}\n\nexport async function buildInitialState({\n context,\n initialState: initialStateFromArgs,\n nodeData,\n}: Props): Promise<InitialLexicalFormState> {\n let initialState: InitialLexicalFormState = initialStateFromArgs ?? {}\n for (const node of nodeData) {\n if ('children' in node) {\n initialState = await buildInitialState({\n context,\n initialState,\n nodeData: node.children as SerializedLexicalNode[],\n })\n }\n\n if (node.type === 'block' || node.type === 'inlineBlock') {\n const blockNode = node as SerializedBlockNode\n const id = blockNode?.fields?.id\n if (!id) {\n continue\n }\n\n const schemaFieldsPath =\n node.type === 'block'\n ? `${context.lexicalFieldSchemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockNode.fields.blockType}.fields`\n : `${context.lexicalFieldSchemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${blockNode.fields.blockType}.fields`\n\n // Build form state for the block\n\n const formStateResult = await fieldSchemasToFormState({\n id: context.id,\n clientFieldSchemaMap: context.clientFieldSchemaMap,\n collectionSlug: context.collectionSlug,\n data: blockNode.fields,\n documentData: context.documentData,\n fields: (context.fieldSchemaMap.get(schemaFieldsPath) as any)?.fields,\n fieldSchemaMap: context.fieldSchemaMap,\n initialBlockData: blockNode.fields,\n operation: context.operation,\n permissions: true,\n preferences: context.preferences,\n readOnly: context.disabled,\n renderAllFields: true, // If this function runs, the parent lexical field is being re-rendered => thus we can assume all its sub-fields need to be re-rendered\n renderFieldFn: context.renderFieldFn,\n req: context.req,\n schemaPath: schemaFieldsPath,\n })\n\n if (!initialState[id]) {\n initialState[id] = {}\n }\n\n initialState[id].formState = formStateResult\n initialState[id].schemaPath = schemaFieldsPath\n\n if (node.type === 'block') {\n const currentFieldPreferences = context.preferences?.fields?.[context.field.name]\n const collapsedArray = currentFieldPreferences?.collapsed\n if (Array.isArray(collapsedArray) && collapsedArray.includes(id)) {\n initialState[id].collapsed = true\n }\n }\n }\n }\n return initialState\n}\n"],"mappings":"AAaA,SAASA,uBAAuB,QAAQ;AAiCxC,OAAO,eAAeC,kBAAkB;EACtCC,OAAO;EACPC,YAAA,EAAcC,oBAAoB;EAClCC;AAAQ,CACF;EACN,IAAIF,YAAA,GAAwCC,oBAAA,IAAwB,CAAC;EACrE,KAAK,MAAME,IAAA,IAAQD,QAAA,EAAU;IAC3B,IAAI,cAAcC,IAAA,EAAM;MACtBH,YAAA,GAAe,MAAMF,iBAAA,CAAkB;QACrCC,OAAA;QACAC,YAAA;QACAE,QAAA,EAAUC,IAAA,CAAKC;MACjB;IACF;IAEA,IAAID,IAAA,CAAKE,IAAI,KAAK,WAAWF,IAAA,CAAKE,IAAI,KAAK,eAAe;MACxD,MAAMC,SAAA,GAAYH,IAAA;MAClB,MAAMI,EAAA,GAAKD,SAAA,EAAWE,MAAA,EAAQD,EAAA;MAC9B,IAAI,CAACA,EAAA,EAAI;QACP;MACF;MAEA,MAAME,gBAAA,GACJN,IAAA,CAAKE,IAAI,KAAK,UACV,GAAGN,OAAA,CAAQW,sBAAsB,mDAAmDJ,SAAA,CAAUE,MAAM,CAACG,SAAS,SAAS,GACvH,GAAGZ,OAAA,CAAQW,sBAAsB,0DAA0DJ,SAAA,CAAUE,MAAM,CAACG,SAAS,SAAS;MAEpI;MAEA,MAAMC,eAAA,GAAkB,MAAMf,uBAAA,CAAwB;QACpDU,EAAA,EAAIR,OAAA,CAAQQ,EAAE;QACdM,oBAAA,EAAsBd,OAAA,CAAQc,oBAAoB;QAClDC,cAAA,EAAgBf,OAAA,CAAQe,cAAc;QACtCC,IAAA,EAAMT,SAAA,CAAUE,MAAM;QACtBQ,YAAA,EAAcjB,OAAA,CAAQiB,YAAY;QAClCR,MAAA,EAAST,OAAA,CAAQkB,cAAc,CAACC,GAAG,CAACT,gBAAA,GAA2BD,MAAA;QAC/DS,cAAA,EAAgBlB,OAAA,CAAQkB,cAAc;QACtCE,gBAAA,EAAkBb,SAAA,CAAUE,MAAM;QAClCY,SAAA,EAAWrB,OAAA,CAAQqB,SAAS;QAC5BC,WAAA,EAAa;QACbC,WAAA,EAAavB,OAAA,CAAQuB,WAAW;QAChCC,QAAA,EAAUxB,OAAA,CAAQyB,QAAQ;QAC1BC,eAAA,EAAiB;QACjBC,aAAA,EAAe3B,OAAA,CAAQ2B,aAAa;QACpCC,GAAA,EAAK5B,OAAA,CAAQ4B,GAAG;QAChBC,UAAA,EAAYnB;MACd;MAEA,IAAI,CAACT,YAAY,CAACO,EAAA,CAAG,EAAE;QACrBP,YAAY,CAACO,EAAA,CAAG,GAAG,CAAC;MACtB;MAEAP,YAAY,CAACO,EAAA,CAAG,CAACsB,SAAS,GAAGjB,eAAA;MAC7BZ,YAAY,CAACO,EAAA,CAAG,CAACqB,UAAU,GAAGnB,gBAAA;MAE9B,IAAIN,IAAA,CAAKE,IAAI,KAAK,SAAS;QACzB,MAAMyB,uBAAA,GAA0B/B,OAAA,CAAQuB,WAAW,EAAEd,MAAA,GAAST,OAAA,CAAQgC,KAAK,CAACC,IAAI,CAAC;QACjF,MAAMC,cAAA,GAAiBH,uBAAA,EAAyBI,SAAA;QAChD,IAAIC,KAAA,CAAMC,OAAO,CAACH,cAAA,KAAmBA,cAAA,CAAeI,QAAQ,CAAC9B,EAAA,GAAK;UAChEP,YAAY,CAACO,EAAA,CAAG,CAAC2B,SAAS,GAAG;QAC/B;MACF;IACF;EACF;EACA,OAAOlC,YAAA;AACT","ignoreList":[]}
@@ -1,8 +1,8 @@
1
1
  import type { RichTextAdapter } from 'payload';
2
2
  import type { ResolvedServerFeatureMap } from '../features/typesServer.js';
3
- import type { LexicalEditorProps } from '../types/index.js';
3
+ import type { LexicalEditorArgs } from '../types/index.js';
4
4
  export declare const getGenerateImportMap: (args: {
5
- lexicalEditorArgs?: LexicalEditorProps;
5
+ lexicalEditorArgs?: LexicalEditorArgs;
6
6
  resolvedFeatureMap: ResolvedServerFeatureMap;
7
7
  }) => RichTextAdapter['generateImportMap'];
8
8
  //# sourceMappingURL=generateImportMap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generateImportMap.d.ts","sourceRoot":"","sources":["../../src/utilities/generateImportMap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAC1E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAE3D,eAAO,MAAM,oBAAoB,SACxB;IACL,iBAAiB,CAAC,EAAE,kBAAkB,CAAA;IACtC,kBAAkB,EAAE,wBAAwB,CAAA;CAC7C,KAAG,eAAe,CAAC,mBAAmB,CAiDtC,CAAA"}
1
+ {"version":3,"file":"generateImportMap.d.ts","sourceRoot":"","sources":["../../src/utilities/generateImportMap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAC1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE1D,eAAO,MAAM,oBAAoB,SACxB;IACL,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IACrC,kBAAkB,EAAE,wBAAwB,CAAA;CAC7C,KAAG,eAAe,CAAC,mBAAmB,CAiDtC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"generateImportMap.js","names":["genImportMapIterateFields","getGenerateImportMap","args","addToImportMap","baseDir","config","importMap","imports","lexicalEditorArgs","views","resolvedFeature","resolvedFeatureMap","values","componentImports","Array","isArray","Object","ClientFeature","nodes","length","node","getSubFields","subFields","fields"],"sources":["../../src/utilities/generateImportMap.tsx"],"sourcesContent":["import type { RichTextAdapter } from 'payload'\n\nimport { genImportMapIterateFields } from 'payload'\n\nimport type { ResolvedServerFeatureMap } from '../features/typesServer.js'\nimport type { LexicalEditorProps } from '../types/index.js'\n\nexport const getGenerateImportMap =\n (args: {\n lexicalEditorArgs?: LexicalEditorProps\n resolvedFeatureMap: ResolvedServerFeatureMap\n }): RichTextAdapter['generateImportMap'] =>\n ({ addToImportMap, baseDir, config, importMap, imports }) => {\n addToImportMap('@payloadcms/richtext-lexical/rsc#RscEntryLexicalCell')\n addToImportMap('@payloadcms/richtext-lexical/rsc#RscEntryLexicalField')\n addToImportMap('@payloadcms/richtext-lexical/rsc#LexicalDiffComponent')\n\n addToImportMap(args.lexicalEditorArgs?.views)\n\n for (const resolvedFeature of args.resolvedFeatureMap.values()) {\n if ('componentImports' in resolvedFeature) {\n if (typeof resolvedFeature.componentImports === 'function') {\n resolvedFeature.componentImports({\n addToImportMap,\n baseDir,\n config,\n importMap,\n imports,\n })\n } else if (Array.isArray(resolvedFeature.componentImports)) {\n addToImportMap(resolvedFeature.componentImports)\n } else if (typeof resolvedFeature.componentImports === 'object') {\n addToImportMap(Object.values(resolvedFeature.componentImports))\n }\n }\n\n addToImportMap(resolvedFeature.ClientFeature)\n\n /*\n * Now run for all possible sub-fields\n */\n if (resolvedFeature.nodes?.length) {\n for (const node of resolvedFeature.nodes) {\n if (typeof node?.getSubFields !== 'function') {\n continue\n }\n const subFields = node.getSubFields({})\n if (subFields?.length) {\n genImportMapIterateFields({\n addToImportMap,\n baseDir,\n config,\n fields: subFields,\n importMap,\n imports,\n })\n }\n }\n }\n }\n }\n"],"mappings":"AAEA,SAASA,yBAAyB,QAAQ;AAK1C,OAAO,MAAMC,oBAAA,GACVC,IAAA,IAID,CAAC;EAAEC,cAAc;EAAEC,OAAO;EAAEC,MAAM;EAAEC,SAAS;EAAEC;AAAO,CAAE;EACtDJ,cAAA,CAAe;EACfA,cAAA,CAAe;EACfA,cAAA,CAAe;EAEfA,cAAA,CAAeD,IAAA,CAAKM,iBAAiB,EAAEC,KAAA;EAEvC,KAAK,MAAMC,eAAA,IAAmBR,IAAA,CAAKS,kBAAkB,CAACC,MAAM,IAAI;IAC9D,IAAI,sBAAsBF,eAAA,EAAiB;MACzC,IAAI,OAAOA,eAAA,CAAgBG,gBAAgB,KAAK,YAAY;QAC1DH,eAAA,CAAgBG,gBAAgB,CAAC;UAC/BV,cAAA;UACAC,OAAA;UACAC,MAAA;UACAC,SAAA;UACAC;QACF;MACF,OAAO,IAAIO,KAAA,CAAMC,OAAO,CAACL,eAAA,CAAgBG,gBAAgB,GAAG;QAC1DV,cAAA,CAAeO,eAAA,CAAgBG,gBAAgB;MACjD,OAAO,IAAI,OAAOH,eAAA,CAAgBG,gBAAgB,KAAK,UAAU;QAC/DV,cAAA,CAAea,MAAA,CAAOJ,MAAM,CAACF,eAAA,CAAgBG,gBAAgB;MAC/D;IACF;IAEAV,cAAA,CAAeO,eAAA,CAAgBO,aAAa;IAE5C;;;IAGA,IAAIP,eAAA,CAAgBQ,KAAK,EAAEC,MAAA,EAAQ;MACjC,KAAK,MAAMC,IAAA,IAAQV,eAAA,CAAgBQ,KAAK,EAAE;QACxC,IAAI,OAAOE,IAAA,EAAMC,YAAA,KAAiB,YAAY;UAC5C;QACF;QACA,MAAMC,SAAA,GAAYF,IAAA,CAAKC,YAAY,CAAC,CAAC;QACrC,IAAIC,SAAA,EAAWH,MAAA,EAAQ;UACrBnB,yBAAA,CAA0B;YACxBG,cAAA;YACAC,OAAA;YACAC,MAAA;YACAkB,MAAA,EAAQD,SAAA;YACRhB,SAAA;YACAC;UACF;QACF;MACF;IACF;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"generateImportMap.js","names":["genImportMapIterateFields","getGenerateImportMap","args","addToImportMap","baseDir","config","importMap","imports","lexicalEditorArgs","views","resolvedFeature","resolvedFeatureMap","values","componentImports","Array","isArray","Object","ClientFeature","nodes","length","node","getSubFields","subFields","fields"],"sources":["../../src/utilities/generateImportMap.tsx"],"sourcesContent":["import type { RichTextAdapter } from 'payload'\n\nimport { genImportMapIterateFields } from 'payload'\n\nimport type { ResolvedServerFeatureMap } from '../features/typesServer.js'\nimport type { LexicalEditorArgs } from '../types/index.js'\n\nexport const getGenerateImportMap =\n (args: {\n lexicalEditorArgs?: LexicalEditorArgs\n resolvedFeatureMap: ResolvedServerFeatureMap\n }): RichTextAdapter['generateImportMap'] =>\n ({ addToImportMap, baseDir, config, importMap, imports }) => {\n addToImportMap('@payloadcms/richtext-lexical/rsc#RscEntryLexicalCell')\n addToImportMap('@payloadcms/richtext-lexical/rsc#RscEntryLexicalField')\n addToImportMap('@payloadcms/richtext-lexical/rsc#LexicalDiffComponent')\n\n addToImportMap(args.lexicalEditorArgs?.views)\n\n for (const resolvedFeature of args.resolvedFeatureMap.values()) {\n if ('componentImports' in resolvedFeature) {\n if (typeof resolvedFeature.componentImports === 'function') {\n resolvedFeature.componentImports({\n addToImportMap,\n baseDir,\n config,\n importMap,\n imports,\n })\n } else if (Array.isArray(resolvedFeature.componentImports)) {\n addToImportMap(resolvedFeature.componentImports)\n } else if (typeof resolvedFeature.componentImports === 'object') {\n addToImportMap(Object.values(resolvedFeature.componentImports))\n }\n }\n\n addToImportMap(resolvedFeature.ClientFeature)\n\n /*\n * Now run for all possible sub-fields\n */\n if (resolvedFeature.nodes?.length) {\n for (const node of resolvedFeature.nodes) {\n if (typeof node?.getSubFields !== 'function') {\n continue\n }\n const subFields = node.getSubFields({})\n if (subFields?.length) {\n genImportMapIterateFields({\n addToImportMap,\n baseDir,\n config,\n fields: subFields,\n importMap,\n imports,\n })\n }\n }\n }\n }\n }\n"],"mappings":"AAEA,SAASA,yBAAyB,QAAQ;AAK1C,OAAO,MAAMC,oBAAA,GACVC,IAAA,IAID,CAAC;EAAEC,cAAc;EAAEC,OAAO;EAAEC,MAAM;EAAEC,SAAS;EAAEC;AAAO,CAAE;EACtDJ,cAAA,CAAe;EACfA,cAAA,CAAe;EACfA,cAAA,CAAe;EAEfA,cAAA,CAAeD,IAAA,CAAKM,iBAAiB,EAAEC,KAAA;EAEvC,KAAK,MAAMC,eAAA,IAAmBR,IAAA,CAAKS,kBAAkB,CAACC,MAAM,IAAI;IAC9D,IAAI,sBAAsBF,eAAA,EAAiB;MACzC,IAAI,OAAOA,eAAA,CAAgBG,gBAAgB,KAAK,YAAY;QAC1DH,eAAA,CAAgBG,gBAAgB,CAAC;UAC/BV,cAAA;UACAC,OAAA;UACAC,MAAA;UACAC,SAAA;UACAC;QACF;MACF,OAAO,IAAIO,KAAA,CAAMC,OAAO,CAACL,eAAA,CAAgBG,gBAAgB,GAAG;QAC1DV,cAAA,CAAeO,eAAA,CAAgBG,gBAAgB;MACjD,OAAO,IAAI,OAAOH,eAAA,CAAgBG,gBAAgB,KAAK,UAAU;QAC/DV,cAAA,CAAea,MAAA,CAAOJ,MAAM,CAACF,eAAA,CAAgBG,gBAAgB;MAC/D;IACF;IAEAV,cAAA,CAAeO,eAAA,CAAgBO,aAAa;IAE5C;;;IAGA,IAAIP,eAAA,CAAgBQ,KAAK,EAAEC,MAAA,EAAQ;MACjC,KAAK,MAAMC,IAAA,IAAQV,eAAA,CAAgBQ,KAAK,EAAE;QACxC,IAAI,OAAOE,IAAA,EAAMC,YAAA,KAAiB,YAAY;UAC5C;QACF;QACA,MAAMC,SAAA,GAAYF,IAAA,CAAKC,YAAY,CAAC,CAAC;QACrC,IAAIC,SAAA,EAAWH,MAAA,EAAQ;UACrBnB,yBAAA,CAA0B;YACxBG,cAAA;YACAC,OAAA;YACAC,MAAA;YACAkB,MAAA,EAAQD,SAAA;YACRhB,SAAA;YACAC;UACF;QACF;MACF;IACF;EACF;AACF","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/richtext-lexical",
3
- "version": "4.0.0-internal.8001944",
3
+ "version": "4.0.0-internal.8089ef7",
4
4
  "description": "The officially supported Lexical richtext adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -443,8 +443,8 @@
443
443
  "react-error-boundary": "6.1.1",
444
444
  "ts-essentials": "10.0.3",
445
445
  "uuid": "14.0.0",
446
- "@payloadcms/translations": "4.0.0-internal.8001944",
447
- "@payloadcms/ui": "4.0.0-internal.8001944"
446
+ "@payloadcms/translations": "4.0.0-internal.8089ef7",
447
+ "@payloadcms/ui": "4.0.0-internal.8089ef7"
448
448
  },
449
449
  "devDependencies": {
450
450
  "@babel/cli": "7.27.2",
@@ -464,14 +464,14 @@
464
464
  "esbuild-sass-plugin": "3.3.1",
465
465
  "swc-plugin-transform-remove-imports": "8.3.0",
466
466
  "@payloadcms/eslint-config": "3.28.0",
467
- "payload": "4.0.0-internal.8001944"
467
+ "payload": "4.0.0-internal.8089ef7"
468
468
  },
469
469
  "peerDependencies": {
470
- "@faceless-ui/modal": "3.0.1",
470
+ "@faceless-ui/modal": "3.0.2",
471
471
  "@faceless-ui/scroll-info": "2.0.0",
472
472
  "react": "^19.0.1 || ^19.1.2 || ^19.2.1",
473
473
  "react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1",
474
- "payload": "4.0.0-internal.8001944"
474
+ "payload": "4.0.0-internal.8089ef7"
475
475
  },
476
476
  "engines": {
477
477
  "node": ">=24.15.0"
@@ -1,2 +0,0 @@
1
- "use client";import{b as Ie,c as $e,e as K,f as j,h as Fe,i as Ke,j as je,k as ze,l as Pe,m as Re,n as He}from"./chunk-3LRZDIIG.js";import{a as Be,b as R}from"./chunk-RJ5MAOKZ.js";import{jsx as v,jsxs as ce}from"react/jsx-runtime";import{getTranslation as bn}from"@payloadcms/translations";import{BulkUploadProvider as xn,FieldDescription as Cn,FieldError as En,FieldLabel as Nn,isFieldRTL as Sn,RenderCustomComponent as jt,useConfig as wn,useEditDepth as Pn,useEffectEvent as Rn,useField as Tn,useLocale as _n,useTranslation as Dn}from"@payloadcms/ui";import{mergeFieldStyles as kn}from"@payloadcms/ui/shared";import{dequal as vn}from"dequal/lite";import zt,{useCallback as Ht,useEffect as Vt,useMemo as Ln,useState as Wt}from"react";import{ErrorBoundary as An}from"react-error-boundary";import"./bundled.css";import{jsx as H}from"react/jsx-runtime";import{LexicalComposer as cn}from"@lexical/react/LexicalComposer.js";import{useEditDepth as dn}from"@payloadcms/ui";import*as Bt from"react";import{useMemo as un}from"react";import{c as Wr}from"react/compiler-runtime";import{jsx as E,jsxs as ae}from"react/jsx-runtime";import{useLexicalComposerContext as Yr}from"@lexical/react/LexicalComposerContext.js";import{LexicalErrorBoundary as Gr}from"@lexical/react/LexicalErrorBoundary.js";import{HistoryPlugin as Ur}from"@lexical/react/LexicalHistoryPlugin.js";import{OnChangePlugin as qr}from"@lexical/react/LexicalOnChangePlugin.js";import{RichTextPlugin as Jr}from"@lexical/react/LexicalRichTextPlugin.js";import{useLexicalEditable as Qr}from"@lexical/react/useLexicalEditable";import{useTranslation as Xr}from"@payloadcms/ui";import{BLUR_COMMAND as Zr,COMMAND_PRIORITY_LOW as Mt,FOCUS_COMMAND as en}from"lexical";import*as z from"react";import{useEffect as tn,useState as on}from"react";import{jsx as Ve}from"react/jsx-runtime";import"react";var W=({anchorElem:e,clientProps:t,plugin:o})=>o.position==="floatingAnchorElem"&&e?o.Component&&Ve(o.Component,{anchorElem:e,clientProps:t}):o.Component&&Ve(o.Component,{clientProps:t});import{c as Ut}from"react/compiler-runtime";import{copyToClipboard as We}from"@lexical/clipboard";import{useLexicalComposerContext as qt}from"@lexical/react/LexicalComposerContext.js";import{objectKlassEquals as Jt}from"@lexical/utils";import Ye from"bson-objectid";import{$getSelection as Qt,$isNodeSelection as Xt,COMMAND_PRIORITY_LOW as Zt,COPY_COMMAND as eo}from"lexical";import{useEffect as to}from"react";var Te=e=>{if("fields"in e&&typeof e.fields=="object"&&e.fields!==null&&"id"in e.fields?e.fields.id=new Ye.default().toHexString():"id"in e&&(e.id=new Ye.default().toHexString()),e.children)for(let t of e.children)Te(t)};function Ge(){let e=Ut(3),[t]=qt(),o,r;return e[0]!==t?(o=()=>t.registerCommand(eo,n=>{let i=Qt();if(Xt(i)){let l=i.getNodes()[0]?.exportJSON(),d=JSON.parse(JSON.stringify(l));Te(d);let u={namespace:t._config.namespace,nodes:[d]},m=JSON.stringify(u);return We(t,null,{"application/x-lexical-editor":m,"text/plain":""}).catch(oo),!0}return We(t,Jt(n,ClipboardEvent)?n:null).then(()=>{if(!(n instanceof ClipboardEvent)||!n.clipboardData)throw new Error("No clipboard event");let s=n.clipboardData.getData("application/x-lexical-editor");if(!s)return!0;let l=JSON.parse(s);for(let u of l.nodes)Te(u);let d=JSON.stringify(l);n.clipboardData.setData("application/x-lexical-editor",d)}).catch(s=>{throw n instanceof ClipboardEvent&&n.clipboardData?.setData("application/x-lexical-editor",""),s}),!0},Zt),r=[t],e[0]=t,e[1]=o,e[2]=r):(o=e[1],r=e[2]),to(o,r),null}function oo(e){throw e}import{c as ro}from"react/compiler-runtime";import{useLexicalComposerContext as no}from"@lexical/react/LexicalComposerContext";import{$findMatchingParent as fe,mergeRegister as io}from"@lexical/utils";import{$createNodeSelection as so,$getEditor as me,$getNearestNodeFromDOMNode as lo,$getSelection as pe,$isDecoratorNode as Y,$isElementNode as _e,$isLineBreakNode as ao,$isNodeSelection as ge,$isRangeSelection as qe,$isRootOrShadowRoot as co,$isTextNode as uo,$onUpdate as fo,$setSelection as Je,CLICK_COMMAND as mo,COMMAND_PRIORITY_LOW as Q,KEY_ARROW_DOWN_COMMAND as po,KEY_ARROW_UP_COMMAND as go,KEY_BACKSPACE_COMMAND as ho,KEY_DELETE_COMMAND as yo,SELECTION_CHANGE_COMMAND as bo}from"lexical";import{useEffect as xo}from"react";function Qe(){let e=ro(3),[t]=no(),o=Po,r,n;return e[0]!==t?(r=()=>io(t.registerCommand(mo,wo,Q),t.registerCommand(yo,o,Q),t.registerCommand(ho,o,Q),t.registerCommand(bo,(i,s)=>{if(s!==t)return!1;let l=!!Ue();return fo(()=>{s.read("latest",()=>{let d=Ue();document.querySelector(".decorator-selected")?.classList.remove("decorator-selected"),d&&s.getElementByKey(d.getKey())?.classList.add("decorator-selected")})}),l},Q),t.registerCommand(go,No,Q),t.registerCommand(po,Co,Q)),n=[t],e[0]=t,e[1]=r,e[2]=n):(r=e[1],n=e[2]),xo(r,n),null}function Co(e){let t=pe();if(ge(t)){e.preventDefault();let s=t.getNodes()[0]?.getNextSibling();if(Y(s)){let u=me().getElementByKey(s.getKey());return u&&ie({element:u,node:s}),!0}if(!_e(s))return!0;let l=s.getFirstDescendant()??s;return l&&(fe(l,he)?.selectEnd(),e.preventDefault()),!0}if(!qe(t))return!1;let r=(t.isBackward()?t.anchor:t.focus).getNode(),n=fe(r,Eo),i=n?.getNextSibling();if(!n||i!==Xe(n))return!1;if(Y(i)){let s=me().getElementByKey(i.getKey());if(s)return ie({element:s,node:i}),e.preventDefault(),!0}return!1}function Eo(e){return Xe(e)!==null}function No(e){let t=pe();if(ge(t)){let s=t.getNodes()[0]?.getPreviousSibling();if(Y(s)){let u=me().getElementByKey(s.getKey());return u?(ie({element:u,node:s}),e.preventDefault(),!0):!1}if(!_e(s))return!1;let l=s.getLastDescendant()??s;return l?(fe(l,he)?.selectStart(),e.preventDefault(),!0):!1}if(!qe(t))return!1;let r=(t.isBackward()?t.anchor:t.focus).getNode(),n=fe(r,So),i=n?.getPreviousSibling();if(!n||i!==Ze(n))return!1;if(Y(i)){let s=me().getElementByKey(i.getKey());if(s)return ie({element:s,node:i}),e.preventDefault(),!0}return!1}function So(e){return Ze(e)!==null}function wo(e){document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");let t=To(e);if(!t)return!0;let{target:o}=e;return!(o instanceof HTMLElement)||o.isContentEditable||o.closest('button, textarea, input, .react-select, .code-editor, .no-select-decorator, [role="button"]')?Je(null):ie(t),!0}function Po(e){let t=pe();return ge(t)?(e.preventDefault(),t.getNodes().forEach(Ro),!0):!1}function Ro(e){e.remove()}function To(e){if(!(e.target instanceof HTMLElement))return;let t=e.target.closest('[data-lexical-decorator="true"]');if(!(t instanceof HTMLElement))return;let o=lo(t);return Y(o)?{element:t,node:o}:void 0}function Ue(){let e=pe();if(!ge(e))return;let t=e.getNodes();if(t.length!==1)return;let o=t[0];return Y(o)?o:void 0}function ie({element:e,node:t}){document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");let o=so();o.add(t.getKey()),Je(o),e.scrollIntoView({behavior:"smooth",block:"nearest"}),e.classList.add("decorator-selected")}function he(e){if(Y(e)&&!e.isInline())return!0;if(!_e(e)||co(e))return!1;let t=e.getFirstChild(),o=t===null||ao(t)||uo(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&o}function Xe(e){let t=e.getNextSibling();for(;t!==null;){if(he(t))return t;t=t.getNextSibling()}return null}function Ze(e){let t=e.getPreviousSibling();for(;t!==null;){if(he(t))return t;t=t.getPreviousSibling()}return null}import{jsx as De}from"react/jsx-runtime";import{useLexicalComposerContext as Ao}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Mo,isHTMLElement as Oo}from"lexical";import*as rt from"react";import{useCallback as Bo,useEffect as ot,useRef as Io,useState as $o}from"react";import{createPortal as Fo}from"react-dom";var X=(e,t,o,r,n=50,i=25)=>{let s=0;if(e&&!e.contains(r)){let{bottom:l,left:d,right:u,top:m}=e.getBoundingClientRect(),a=m+window.scrollY,c=l+window.scrollY;if(o<a-i||o>c+i||t<d-n||t>u+n)return-1;(t<d||t>u)&&(s=t<d?t-d:t-u)}return s};import{$getNodeByKey as be}from"lexical";function Z(e){let t=e.getBoundingClientRect(),o=getComputedStyle(e).getPropertyValue("transform");if(!o||o==="none")return t;let r=o.split(",").pop();return t.y=t.y-Number(r?.replace(")","")),t}function ye(e){let t=(d,u)=>d?parseFloat(window.getComputedStyle(d)[u]):0,{marginBottom:o,marginTop:r}=window.getComputedStyle(e),n=t(e.previousElementSibling,"marginBottom"),i=t(e.nextElementSibling,"marginTop"),s=Math.max(parseFloat(r),n);return{marginBottom:Math.max(parseFloat(o),i),marginTop:s}}import{$getRoot as _o}from"lexical";function G(e){return e.getEditorState().read(()=>_o().getChildrenKeys())}var Do=1,ko=-1,et=0,M={props:null,result:null};function vo(e,t,o=20){let r=e.x-t.x,n=e.y-t.y;return r*r+n*n<=o*o}function ee(e){let{anchorElem:t,cache_threshold:o=20,editor:r,fuzzy:n=!1,horizontalOffset:i=0,point:{x:s,y:l},startIndex:d=0,useEdgeAsDefault:u=!1}=e;if(o>0&&M.props&&M.result&&M.props.fuzzy===e.fuzzy&&M.props.horizontalOffset===e.horizontalOffset&&M.props.useEdgeAsDefault===e.useEdgeAsDefault&&vo(M.props.point,e.point,o))return M.result;let m=t.getBoundingClientRect(),a=G(r),c={blockElem:null,blockNode:null,distance:1/0,foundAtIndex:-1,isFoundNodeEmptyParagraph:!1};return r.getEditorState().read(()=>{if(u){let f=r.getElementByKey(a[0]),p=r.getElementByKey(a[a.length-1]);if(f&&p){let[h,C]=[Z(f),Z(p)];if(l<h.top?(c.blockElem=f,c.distance=h.top-l,c.blockNode=be(a[0]),c.foundAtIndex=0):l>C.bottom&&(c.distance=l-C.bottom,c.blockNode=be(a[a.length-1]),c.blockElem=p,c.foundAtIndex=a.length-1),c?.blockElem)return{blockElem:null,isFoundNodeEmptyParagraph:!1}}}let g=d,y=et;for(;g>=0&&g<a.length;){let f=a[g],p=r.getElementByKey(f);if(p===null)break;let h=new j(s+i,l),C=ze.fromDOMRect(Z(p)),{marginBottom:x,marginTop:N}=ye(p),b=C.generateNewRect({bottom:C.bottom+x,left:m.left,right:m.right,top:C.top-N}),{distance:S,isOnBottomSide:D,isOnTopSide:_}=b.distanceFromPoint(h);if(S===0){c.blockElem=p,c.blockNode=be(f),c.foundAtIndex=g,c.distance=S,c.blockNode&&c.blockNode.getType()==="paragraph"&&c.blockNode.getTextContent()===""&&(!n&&!e.returnEmptyParagraphs&&(c.blockElem=null,c.blockNode=null),c.isFoundNodeEmptyParagraph=!0);break}else n&&S<c.distance&&(c.blockElem=p,c.blockNode=be(f),c.distance=S,c.foundAtIndex=g);y===et&&(_?y=ko:D?y=Do:y=1/0),g+=y}}),M.props=e,M.result={blockElem:c.blockElem,blockNode:c.blockNode,foundAtIndex:c.foundAtIndex,isFoundNodeEmptyParagraph:c.isFoundNodeEmptyParagraph},{blockElem:c.blockElem,blockNode:c.blockNode,foundAtIndex:c.foundAtIndex,isFoundNodeEmptyParagraph:c.isFoundNodeEmptyParagraph}}function xe(e,t){return!!e.closest(`.${t}`)}var Lo=["IMG","INPUT","TEXTAREA","SELECT","BUTTON","VIDEO","OBJECT","EMBED","IFRAME","HR"];function tt(e){if(!e||Lo.includes(e.tagName)||e.offsetHeight===0||e.offsetWidth===0)return!1;let t=window.getComputedStyle(e);return!(t.display==="table-cell"||t.position==="absolute"||t.visibility==="hidden"||t.opacity==="0")}function Ce(e,t,o,r=0){if(!e){t.style.visibility="hidden",t.style.opacity="0",t.style.transform="translate(-10000px, -10000px)";return}let n=e.getBoundingClientRect(),i=window.getComputedStyle(e),s=t.getBoundingClientRect(),l=o.getBoundingClientRect(),d;if(["LexicalEditorTheme__block","LexicalEditorTheme__upload","LexicalEditorTheme__relationship"].some(a=>e.classList.contains(a)||e.firstElementChild?.classList.contains(a)))d=n.top+8-l.top;else{let a=tt(e)?parseInt(i.lineHeight,10):0;d=n.top+(a-s.height)/2-l.top}let m=r;t.style.opacity="1",t.style.visibility="visible",t.style.transform=`translate(${m}px, ${d}px)`}var Ko="add-block-menu",Ee=1/0;function jo(e){return e===0?1/0:Ee>=0&&Ee<e?Ee:Math.floor(e/2)}function zo(e,t,o){let r=t.parentElement,{editorConfig:n}=R(),i=n?.admin?.hideGutter?-24:12,s=Io(null),[l,d]=$o(null);ot(()=>{function m(a){let c=a.target;if(!Oo(c))return;let g=X(r,a.pageX,a.pageY,c);if(g===-1){d(null);return}if(xe(c,Ko))return;let y=G(e),{blockElem:f,blockNode:p,foundAtIndex:h}=ee({anchorElem:t,cache_threshold:0,editor:e,horizontalOffset:-g,point:new j(a.x,a.y),returnEmptyParagraphs:!0,startIndex:jo(y.length),useEdgeAsDefault:!1});Ee=h,f&&p&&(l?.node!==p||l?.elem!==f)&&d({elem:f,node:p})}return document?.addEventListener("mousemove",m),()=>{document?.removeEventListener("mousemove",m)}},[r,t,e,l]),ot(()=>{s.current&&Ce(l?.elem??null,s.current,t,i)},[t,l,i]);let u=Bo(m=>{let a=l;a?.node&&(e.update(()=>{let c=!0;if((a?.node.getType()!=="paragraph"||a.node.getTextContent()!=="")&&(c=!1),!c){let g=Mo();a?.node.insertAfter(g),setTimeout(()=>{a={elem:e.getElementByKey(g.getKey()),node:g},d(a)},0)}}),setTimeout(()=>{e.update(()=>{e.focus(),a?.node&&"select"in a.node&&typeof a.node.select=="function"&&a.node.select()})},1),setTimeout(()=>{e.dispatchCommand(Ke,{node:a?.node})},2),m.stopPropagation(),m.preventDefault())},[e,l]);return Fo(De(rt.Fragment,{children:De("button",{"aria-label":"Add block",className:"icon add-block-menu",onClick:m=>{u(m)},ref:s,type:"button",children:De("div",{className:o?"icon":""})})}),t)}function nt(e){let{anchorElem:t}=e,o=t===void 0?document.body:t,[r]=Ao();return zo(r,o,r._editable)}import{jsx as Ne,jsxs as dt}from"react/jsx-runtime";import{useLexicalComposerContext as Jo}from"@lexical/react/LexicalComposerContext.js";import{eventFiles as ut}from"@lexical/rich-text";import{useTranslation as Qo}from"@payloadcms/ui";import{$getNearestNodeFromDOMNode as ft,$getNodeByKey as Xo,isHTMLElement as ke}from"lexical";import*as yt from"react";import{useEffect as ve,useId as Zo,useRef as se,useState as mt}from"react";import{createPortal as er}from"react-dom";var it=0,Ho=-24;var U=0;function st(e,t,o,r,n,i,s,l,d,u=!1){let{height:m,top:a}=r.getBoundingClientRect(),{top:c,width:g}=s.getBoundingClientRect(),{marginBottom:y,marginTop:f}=ye(r),p=a,h=i>=a+m/2+window.scrollY,C=!1;if(n?.elem)if(r!==n?.elem)(h&&n?.elem&&n?.elem===r.nextElementSibling||!h&&n?.elem&&n?.elem===r.previousElementSibling)&&(U++,U<200&&(C=!0));else{U++;let S=n?.boundingBox?.y,D=r.getBoundingClientRect().y;(h===n?.isBelow&&S===D||U<200)&&(C=!1)}if(C)return{isBelow:h,willStayInSamePosition:C};u?p+=m/2:h?p+=m+y/2:p-=f/2;let x=0;u||(h?x=-it:x=it);let N=p-c+x,b=Ho-t;return o.style.width=`calc(${g}px - ${e} - var(--spacer-5))`,o.style.opacity=".8",o.style.transform=`translate(${b}px, calc(${N}px - 2px))`,n?.elem&&(n.elem.style.opacity="",n?.elem===r?h?n.elem.style.marginTop="":n.elem.style.marginBottom="":(n.elem.style.marginBottom="",n.elem.style.marginTop="")),U=0,{isBelow:h,willStayInSamePosition:C}}import{mergeRegister as Vo}from"@lexical/utils";import{$getSelection as Wo,$isNodeSelection as Yo,$isRangeSelection as Go,COMMAND_PRIORITY_HIGH as lt,KEY_ARROW_DOWN_COMMAND as Uo,KEY_ARROW_UP_COMMAND as qo}from"lexical";import{useEffect as at}from"react";function ct({editor:e,instructionsID:t}){at(()=>{let o=({direction:r,event:n})=>{if(!e.isEditable()||!n.altKey||!n.shiftKey||n.ctrlKey||n.metaKey)return!1;let i=Wo(),l=(Go(i)&&i.isCollapsed()?i.anchor.getNode():Yo(i)&&i.getNodes().length===1?i.getNodes()[0]:null)?.getTopLevelElement();if(!l)return!1;n.preventDefault();let d=r===-1?l.getPreviousSibling():l.getNextSibling();return d&&(r===-1?d.insertBefore(l):d.insertAfter(l)),!0};return Vo(e.registerCommand(qo,r=>o({direction:-1,event:r}),lt),e.registerCommand(Uo,r=>o({direction:1,event:r}),lt))},[e]),at(()=>{let o,r=e.registerRootListener(n=>{if(o?.(),!n)return;let i=n.getAttribute("aria-describedby");n.setAttribute("aria-describedby",[i,t].filter(Boolean).join(" ")),o=()=>{i===null?n.removeAttribute("aria-describedby"):n.setAttribute("aria-describedby",i)}});return()=>{r(),o?.()}},[e,t])}var tr="draggable-block-menu",pt="application/x-lexical-drag-block",le=1/0;function gt(e){return e===0?1/0:le>=0&&le<e?le:Math.floor(e/2)}function or(e,t){let{transform:o}=t.style;e.setDragImage(t,0,0),setTimeout(()=>{t.style.transform=o})}function ht(e,t){e&&(e.style.opacity="0"),t&&(t.style.opacity="",t.style.marginBottom="",t.style.marginTop="")}function rr(e,t,o){let r=t.parentElement,n=Zo(),{t:i}=Qo();ct({editor:e,instructionsID:n});let s=se(null),l=se(null),d=se(null),u=se(!1),m=se([]),[a,c]=mt(null),[g,y]=mt(null),{editorConfig:f}=R(),p=f?.admin?.hideGutter?-44:-8;ve(()=>{function x(N){let b=N.target;if(!ke(b))return;let S=X(r,N.pageX,N.pageY,b);if(S===-1){c(null);return}if(xe(b,tr))return;let D=G(e),{blockElem:_,foundAtIndex:B,isFoundNodeEmptyParagraph:V}=ee({anchorElem:t,cache_threshold:0,editor:e,horizontalOffset:-S,point:new j(N.x,N.y),startIndex:gt(D.length),useEdgeAsDefault:!1,verbose:!1});le=B,!(!_&&!V)&&a!==_&&c(_)}return document?.addEventListener("mousemove",x),()=>{document?.removeEventListener("mousemove",x)}},[r,t,e,a]),ve(()=>{s.current&&Ce(a,s.current,t,p)},[t,a,p]),ve(()=>{function x(b){if(!u.current)return!1;let[S]=ut(b);if(S)return!1;let{pageY:D,target:_}=b;if(!ke(_))return!1;let B=X(r,b.pageX,b.pageY,_,100,50),V=G(e),{blockElem:w,foundAtIndex:k,isFoundNodeEmptyParagraph:I}=ee({anchorElem:t,editor:e,fuzzy:!0,horizontalOffset:-B,point:new j(b.x,b.y),startIndex:gt(V.length),useEdgeAsDefault:!0,verbose:!0});le=k;let $=l.current;if(w===null||$===null)return!1;if(b.preventDefault(),b.dataTransfer.dropEffect="move",a!==w){let{isBelow:T,willStayInSamePosition:q}=st(f?.admin?.hideGutter?"0px":"var(--spacer-5)",p+(f?.admin?.hideGutter?s?.current?.getBoundingClientRect()?.width??0:-(s?.current?.getBoundingClientRect()?.width??0)),$,w,g,D,t,b,d,I);q||y({boundingBox:w.getBoundingClientRect(),elem:w,isBelow:T})}else g?.elem&&(ht($,g.elem),y({boundingBox:w.getBoundingClientRect(),elem:w,isBelow:!1}));return!0}function N(b){if(!u.current)return!1;let[S]=ut(b);if(S)return!1;let{dataTransfer:D,pageY:_,target:B}=b,V=D?.getData(pt)||"";return e.update(()=>{let w=Xo(V);if(!w||!ke(B))return!1;let k=X(r,b.pageX,b.pageY,B,100,50),{blockElem:I,isFoundNodeEmptyParagraph:$}=ee({anchorElem:t,editor:e,fuzzy:!0,horizontalOffset:-k,point:new j(b.x,b.y),useEdgeAsDefault:!0});if(!I)return!1;let T=ft(I);if(!T)return!1;if(T===w)return!0;let{height:q,top:J}=Z(I),Se=_>=J+q/2+window.scrollY;$?(T.insertBefore(w),T.remove()):Se?T.insertAfter(w):T.insertBefore(w),a!==null&&c(null),document.querySelectorAll(".lexical-block-highlighter").forEach(L=>{L.remove()});let de=e.getElementByKey(w.getKey()),F=setTimeout(()=>{let L=de?.getBoundingClientRect();if(!L)return;let P=document.createElement("div");P.className="lexical-block-highlighter",P.style.backgroundColor="var(--color-bg-inverse)",P.style.transition="opacity 0.5s ease-in-out",P.style.zIndex="1",P.style.pointerEvents="none",P.style.boxSizing="border-box",P.style.borderRadius="4px",P.style.position="absolute",document.body.appendChild(P),P.style.opacity="0.1",P.style.height=`${L.height+8}px`,P.style.width=`${L.width+8}px`,P.style.top=`${L.top+window.scrollY-4}px`,P.style.left=`${L.left-4}px`;let ue=setTimeout(()=>{P.style.opacity="0";let we=setTimeout(()=>{P.remove()},500);m.current.push(we)},1e3);m.current.push(ue)},120);m.current.push(F)}),!0}return document.addEventListener("dragover",x),document.addEventListener("drop",N),()=>{document.removeEventListener("dragover",x),document.removeEventListener("drop",N),m.current.forEach(clearTimeout),m.current=[]}},[r,p,t,e,g,a,f?.admin?.hideGutter]);function h(x){let N=x.dataTransfer;if(!N||!a)return;or(N,a),N.effectAllowed="move";let b="";e.update(()=>{let S=ft(a);S&&(b=S.getKey())}),u.current=!0,N.setData(pt,b)}function C(){u.current=!1,g?.elem&&ht(l.current,g?.elem)}return er(dt(yt.Fragment,{children:[dt("span",{className:"sr-only",id:n,children:[i("general:moveUp"),": Alt + Shift + \u2191. ",i("general:moveDown"),": Alt + Shift + \u2193."]}),Ne("button",{"aria-label":"Drag to move",className:"icon draggable-block-menu",draggable:!0,onDragEnd:C,onDragStart:h,ref:s,type:"button",children:Ne("div",{className:o?"icon":""})}),Ne("div",{className:"draggable-block-target-line",ref:l}),Ne("div",{className:"debug-highlight",ref:d})]}),t)}function bt(e){let{anchorElem:t}=e,o=t===void 0?document.body:t,[r]=Jo();return rr(r,o,r._editable)}import{c as nr}from"react/compiler-runtime";import{jsx as Le}from"react/jsx-runtime";import{useLexicalComposerContext as ir}from"@lexical/react/LexicalComposerContext";import{useTranslation as sr}from"@payloadcms/ui";import{$createParagraphNode as lr,$getRoot as ar}from"lexical";import"react";var xt="insert-paragraph-at-end",Ct=()=>{let e=nr(5),[t]=ir(),{editorConfig:o}=R(),{t:r}=sr();if(o?.admin?.hideInsertParagraphAtEnd)return null;let n;e[0]!==t?(n=()=>{t.update(cr)},e[0]=t,e[1]=n):n=e[1];let i=n,s;return e[2]!==i||e[3]!==r?(s=Le("button",{"aria-label":r("lexical:general:insertParagraph"),className:xt,onClick:i,type:"button",children:Le("span",{className:`${xt}-inside`,children:Le(Ie,{size:16})})}),e[2]=i,e[3]=r,e[4]=s):s=e[4],s};function cr(){let e=lr();ar().append(e),e.select()}import{c as dr}from"react/compiler-runtime";import{registerMarkdownShortcuts as ur}from"@lexical/markdown";import{useLexicalComposerContext as fr}from"@lexical/react/LexicalComposerContext";import*as Et from"react";var Nt=()=>{let e=dr(4),{editorConfig:t}=R(),[o]=fr(),r,n;return e[0]!==o||e[1]!==t.features.markdownTransformers?(r=()=>ur(o,t.features.markdownTransformers??[]),n=[o,t.features.markdownTransformers],e[0]=o,e[1]=t.features.markdownTransformers,e[2]=r,e[3]=n):(r=e[2],n=e[3]),Et.useEffect(r,n),null};import{c as mr}from"react/compiler-runtime";import{useLexicalComposerContext as pr}from"@lexical/react/LexicalComposerContext.js";import{$getRoot as gr}from"lexical";import{useEffect as hr}from"react";function yr(e){e.update(()=>{let t=o=>{let r=o.getType();if((r==="block"||r==="inlineBlock")&&o.markDirty(),"getChildren"in o&&typeof o.getChildren=="function")for(let n of o.getChildren())t(n)};t(gr())})}function St(){let e=mr(5),[t]=pr(),{currentView:o,views:r}=K(),n,i;return e[0]!==o||e[1]!==t||e[2]!==r?(n=()=>{r&&(o==="default"?r.default?Pe(t,r.default?.nodes):Re(t):r[o]&&(Re(t),Pe(t,r[o]?.nodes)),yr(t))},i=[t,r,o],e[0]=o,e[1]=t,e[2]=r,e[3]=n,e[4]=i):(n=e[3],i=e[4]),hr(n,i),null}import{useLexicalComposerContext as br}from"@lexical/react/LexicalComposerContext";import{$getSelection as xr,$isRangeSelection as Cr,RootNode as Er}from"lexical";import{useEffect as Nr}from"react";function wt(){let[e]=br();return Nr(()=>e.registerNodeTransform(Er,t=>{let o=xr();if(Cr(o)){let r=o.anchor.getNode(),n=o.focus.getNode();(!r.isAttached()||!n.isAttached())&&(t.selectEnd(),console.warn("updateEditor: selection has been moved to the end of the editor because the previously selected nodes have been removed and selection wasn't moved to another node. Ensure selection changes after removing/replacing a selected node."))}return!1}),[e]),null}import{useLexicalComposerContext as Sr}from"@lexical/react/LexicalComposerContext";import{$getSelection as wr,COMMAND_PRIORITY_LOW as Pr,SELECT_ALL_COMMAND as Rr}from"lexical";import{useEffect as Tr}from"react";function Pt(){let[e]=Sr();return Tr(()=>e.registerCommand(Rr,()=>{if(wr())return!1;let o=document.activeElement;return o instanceof HTMLInputElement&&o.select(),!0},Pr),[e]),null}import{jsx as te,jsxs as Tt}from"react/jsx-runtime";import{useLexicalComposerContext as Dr}from"@lexical/react/LexicalComposerContext.js";import{useTranslation as _t}from"@payloadcms/ui";import{useCallback as kr,useMemo as vr,useState as Lr}from"react";import"react";import*as Dt from"react-dom";import{c as _r}from"react/compiler-runtime";import"react";function Rt(e,t){let o=_r(4),{maxLength:r,minLength:n}=t,i=r===void 0?75:r,s=n===void 0?1:n,l;return o[0]!==i||o[1]!==s||o[2]!==e?(l=d=>{let{query:u}=d,m="[^"+e+Fe+"\\s]",c=new RegExp("(^|\\s|\\()(["+e+"]((?:"+m+"){0,"+i+"}))$").exec(u);if(c!==null){let g=c[1],y=c[3];if(y.length>=s)return{leadOffset:c.index+g.length,matchingString:y,replaceableString:c[2]}}return null},o[0]=i,o[1]=s,o[2]=e,o[3]=l):l=o[3],l}var O="slash-menu-popup";function Ar({isSelected:e,item:t,onClick:o,onMouseEnter:r,ref:n}){let{fieldProps:{featureClientSchemaMap:i,schemaPath:s}}=R(),{i18n:l}=_t(),d=`${O}__item ${O}__item-${t.key}`;e&&(d+=` ${O}__item--selected`);let u=t.key;return t.label&&(u=typeof t.label=="function"?t.label({featureClientSchemaMap:i,i18n:l,schemaPath:s}):t.label),u.length>25&&(u=u.substring(0,25)+"..."),Tt("button",{"aria-selected":e,className:d,id:O+"__item-"+t.key,onClick:o,onMouseEnter:r,ref:n,role:"option",tabIndex:-1,type:"button",children:[t?.Icon&&te(t.Icon,{}),te("span",{className:`${O}__item-text`,children:u})]},t.key)}function kt({anchorElem:e=document.body}){let[t]=Dr(),[o,r]=Lr(null),{editorConfig:n}=R(),{i18n:i}=_t(),{fieldProps:{featureClientSchemaMap:s,schemaPath:l}}=R(),d=Rt("/",{minLength:0}),u=kr(()=>{let a=[];for(let c of n.features.slashMenu.dynamicGroups)if(o){let g=c({editor:t,queryString:o});a=a.concat(g)}return a},[t,o,n?.features]),m=vr(()=>{let a=[];for(let c of n?.features.slashMenu.groups??[])a.push(c);if(o){let c=o.toLowerCase().replace(/[\s\-_]/g,"");a=a.map(y=>{let f=y.items.filter(p=>{let h=p.key;return p.label&&(h=typeof p.label=="function"?p.label({featureClientSchemaMap:s,i18n:i,schemaPath:l}):p.label),new RegExp(o,"gi").exec(h)||h.toLowerCase().replace(/[\s\-_]/g,"").includes(c)?!0:p.keywords!=null?p.keywords.some(x=>new RegExp(o,"gi").exec(x)?!0:x.toLowerCase().replace(/[\s\-_]/g,"").includes(c)):!1});return f.length?{...y,items:f}:null}),a=a.filter(y=>y!=null);let g=u();for(let y of g){let f=a.find(p=>p.key===y.key);f?a=a.filter(p=>p.key!==y.key):f={...y,items:[]},f?.items?.length&&(f.items=f.items.concat(f.items)),a.push(f)}}return a},[o,n?.features.slashMenu.groups,u,s,i,l]);return te(je,{anchorElem:e,groups:m,menuRenderFn:(a,{selectedItemKey:c,selectItemAndCleanUp:g,setSelectedItemKey:y})=>a.current&&m.length?Dt.createPortal(te("div",{className:O,"data-theme":"dark",children:m.map(f=>{let p=f.key;return f.label&&s&&(p=typeof f.label=="function"?f.label({featureClientSchemaMap:s,i18n:i,schemaPath:l}):f.label),Tt("div",{className:`${O}__group ${O}__group-${f.key}`,children:[te("div",{className:`${O}__group-title`,children:p}),f.items.map((h,C)=>te(Ar,{index:C,isSelected:c===h.key,item:h,onClick:()=>{y(h.key),g(h)},onMouseEnter:()=>{y(h.key)},ref:x=>{h.ref={current:x}}},h.key))]},f.key)})}),a.current):null,onQueryChange:r,triggerFn:d})}import{c as Mr}from"react/compiler-runtime";import{useLexicalComposerContext as Or}from"@lexical/react/LexicalComposerContext";import{TEXT_TYPE_TO_FORMAT as Br,TextNode as Ir}from"lexical";import{useEffect as $r}from"react";function vt(e){let t=Mr(6),{features:o}=e,[r]=Or(),n;t[0]!==r||t[1]!==o.enabledFormats?(n=()=>{let s=Fr(o.enabledFormats);if(s.length!==0)return r.registerNodeTransform(Ir,l=>{s.forEach(d=>{l.hasFormat(d)&&l.toggleFormat(d)})})},t[0]=r,t[1]=o.enabledFormats,t[2]=n):n=t[2];let i;return t[3]!==r||t[4]!==o?(i=[r,o],t[3]=r,t[4]=o,t[5]=i):i=t[5],$r(n,i),null}function Fr(e){let t=Object.keys(Br),o=new Set(e);return t.filter(r=>!o.has(r))}import{c as Kr}from"react/compiler-runtime";import{jsx as Lt}from"react/jsx-runtime";import{useLexicalComposerContext as jr}from"@lexical/react/LexicalComposerContext";import{ContentEditable as zr}from"@lexical/react/LexicalContentEditable.js";import{getTranslation as Hr}from"@payloadcms/translations";import{useTranslation as Vr}from"@payloadcms/ui";import"react";function At(e){let t=Kr(9),{className:o,editorConfig:r,instructionsID:n}=e,{fieldProps:i}=R(),{i18n:s,t:l}=Vr(),[,d]=jr(),{getTheme:u}=d,m;if(t[0]!==o||t[1]!==r?.admin?.placeholder||t[2]!==i.field.label||t[3]!==i.field.required||t[4]!==u||t[5]!==s||t[6]!==n||t[7]!==l){let a=u();m=Lt(zr,{"aria-describedby":n,"aria-label":Hr(i.field.label||"",s),"aria-placeholder":l("lexical:general:placeholder"),"aria-required":i.field.required||void 0,className:o??"ContentEditable__root",placeholder:Lt("p",{className:a?.placeholder,children:r?.admin?.placeholder??l("lexical:general:placeholder")})}),t[0]=o,t[1]=r?.admin?.placeholder,t[2]=i.field.label,t[3]=i.field.required,t[4]=u,t[5]=s,t[6]=n,t[7]=l,t[8]=m}else m=t[8];return m}var Ot=e=>{let t=Wr(5),{editorConfig:o,editorContainerRef:r,isSmallWidthViewport:n,onChange:i,rtl:s}=e,l=R(),[d]=Yr(),u=Qr(),{t:m}=Xr(),a=z.useId(),c=u&&o.features.enabledFeatures.includes("indent"),[g,y]=on(null),f;t[0]===Symbol.for("react.memo_cache_sentinel")?(f=x=>{x!==null&&y(x)},t[0]=f):f=t[0];let p=f,h,C;return t[1]!==d||t[2]!==l?(h=()=>{if(!l?.uuid){console.error("Lexical Editor must be used within an EditorConfigProvider");return}l?.parentEditor?.uuid&&l.parentEditor?.registerChild(l.uuid,l);let x=()=>{l.focusEditor(l)},N=()=>{l.blurEditor(l)},b=d.registerCommand(en,()=>(x(),!0),Mt),S=d.registerCommand(Zr,()=>(N(),!0),Mt);return()=>{b(),S(),l.parentEditor?.unregisterChild?.(l.uuid)}},C=[d,l],t[1]=d,t[2]=l,t[3]=h,t[4]=C):(h=t[3],C=t[4]),tn(h,C),ae(z.Fragment,{children:[o.features.plugins?.map(rn),ae("div",{className:"editor-container",dir:s?"rtl":void 0,ref:r,children:[o.features.plugins?.map(nn),E(Jr,{contentEditable:E("div",{className:"editor-scroller",children:E("div",{className:"editor",ref:p,children:E(At,{editorConfig:o,instructionsID:c?a:void 0})})}),ErrorBoundary:Gr}),E(wt,{}),u&&E(Ct,{}),E(Qe,{}),E(Ge,{}),E(vt,{features:o.features}),E(Pt,{}),E(St,{}),u&&E(qr,{ignoreSelectionChange:!0,onChange:(x,N,b)=>{(!b.has("focus")||b.size>1)&&i?.(x,N,b)}}),g&&ae(z.Fragment,{children:[!n&&u&&ae(z.Fragment,{children:[o.admin?.hideDraggableBlockElement?null:E(bt,{anchorElem:g}),o.admin?.hideAddBlockButton?null:E(nt,{anchorElem:g})]}),o.features.plugins?.map(x=>{if(x.position==="floatingAnchorElem"&&!(x.desktopOnly===!0&&n))return E(W,{anchorElem:g,clientProps:x.clientProps,plugin:x},x.key)}),u&&E(z.Fragment,{children:E(kt,{anchorElem:g})})]}),u&&ae(z.Fragment,{children:[E(Ur,{}),o?.features?.markdownTransformers?.length>0&&E(Nt,{})]}),o.features.plugins?.map(sn),o.features.plugins?.map(ln)]}),c&&E("p",{className:"ContentEditable__keyboard-hint",id:a,children:m("lexical:indent:keyboardHint")}),o.features.plugins?.map(an)]})};function rn(e){if(e.position==="aboveContainer")return E(W,{clientProps:e.clientProps,plugin:e},e.key)}function nn(e){if(e.position==="top")return E(W,{clientProps:e.clientProps,plugin:e},e.key)}function sn(e){if(e.position==="normal")return E(W,{clientProps:e.clientProps,plugin:e},e.key)}function ln(e){if(e.position==="bottom")return E(W,{clientProps:e.clientProps,plugin:e},e.key)}function an(e){if(e.position==="belowContainer")return E(W,{clientProps:e.clientProps,plugin:e},e.key)}var It=({children:e,providers:t})=>{if(!t?.length)return e;let o=t[0];return t.length>1?H(o,{children:H(It,{providers:t.slice(1),children:e})}):H(o,{children:e})},$t=e=>{let{composerKey:t,editorConfig:o,fieldProps:r,isSmallWidthViewport:n,onChange:i,readOnly:s,rtl:l,value:d}=e,{currentView:u,views:m}=K(),a=R(),c=dn(),g=Bt.useRef(null),y=un(()=>{if(d&&typeof d!="object")throw new Error("The value passed to the Lexical editor is not an object. This is not supported. Please remove the data from the field and start again. This is the value that was passed in: "+JSON.stringify(d));if(d&&Array.isArray(d)&&!("root"in d))throw new Error("You have tried to pass in data from the old Slate editor to the new Lexical editor. The data structure is different, thus you will have to migrate your data. We offer a one-line migration script which migrates all your rich text fields: https://payloadcms.com/docs/lexical/migration#migration-via-migration-script-recommended");if(d&&"jsonContent"in d)throw new Error("You have tried to pass in data from payload-plugin-lexical. The data structure is different, thus you will have to migrate your data. Migration guide: https://payloadcms.com/docs/lexical/migration#migrating-from-payload-plugin-lexical");let f=m?.[u]?.nodes;return{editable:s!==!0,editorState:d!=null?JSON.stringify(d):void 0,namespace:o.lexical.namespace,nodes:He({editorConfig:o,nodeViews:f}),onError:p=>{throw p},theme:o.lexical.theme}},[o,m,u]);return y?H(cn,{initialConfig:y,children:H(Be,{editorConfig:o,editorContainerRef:g,fieldProps:r,parentContext:a?.editDepth===c?a:void 0,children:H(It,{providers:o.features.providers,children:H(Ot,{editorConfig:o,editorContainerRef:g,isSmallWidthViewport:n,onChange:i,rtl:l})})})},t+y.editable+u):H("p",{children:"Loading..."})};import{c as fn}from"react/compiler-runtime";import{jsx as oe,jsxs as mn}from"react/jsx-runtime";import{ChevronIcon as pn,Popup as gn,PopupList as Ft}from"@payloadcms/ui";import"react";function Kt(){let e=fn(5),{currentView:t,setCurrentView:o,views:r}=K();if(!r||Object.keys(r).length===0)return null;let n,i;if(e[0]!==t||e[1]!==o||e[2]!==r){i=Symbol.for("react.early_return_sentinel");e:{let s=Object.keys(r);if(!s.some(yn)){i=null;break e}let d=["default",...s.filter(hn)],u=t.charAt(0).toUpperCase()+t.slice(1);n=oe("div",{className:"lexical-view-selector",children:oe(gn,{button:mn("button",{className:"lexical-view-selector__button",type:"button",children:[oe("span",{className:"lexical-view-selector__label",children:u}),oe(pn,{className:"lexical-view-selector__icon"})]}),buttonType:"custom",horizontalAlign:"left",popupType:"menu",render:m=>{let{close:a}=m;return oe(Ft.ButtonGroup,{children:d.map(c=>{let g=c.charAt(0).toUpperCase()+c.slice(1);return oe(Ft.Button,{active:c===t,disabled:c===t,onClick:()=>{o?.(c),a()},children:g},c)})})},size:"large"})})}e[0]=t,e[1]=o,e[2]=r,e[3]=n,e[4]=i}else n=e[3],i=e[4];return i!==Symbol.for("react.early_return_sentinel")?i:n}function hn(e){return e!=="default"}function yn(e){return e!=="default"}var re="rich-text-lexical",Mn=e=>{let{editorConfig:t,field:o,field:{admin:{className:r,description:n,readOnly:i}={},label:s,localized:l,required:d},path:u,readOnly:m,schemaPath:a,validate:c}=e,{i18n:g}=Dn(),y=m||i,f=_n(),{config:{localization:p}}=wn(),h=Sn({fieldLocalized:l,locale:f,localizationConfig:p||void 0}),C=Pn(),{isControlledByParent:x}=K(),N=Ht((A,ne)=>typeof c=="function"?c(A,{...ne,required:d}):!0,[c,d]),{customComponents:{AfterInput:b,BeforeInput:S,Description:D,Error:_,Label:B}={},disabled:V,initialValue:w,path:k,setValue:I,showError:$,value:T}=Tn({potentiallyStalePath:u,validate:N}),q=y||V,[J,Ae]=Wt(!1),[Se,Me]=Wt(),de=zt.useRef(w),F=zt.useRef(T);Vt(()=>{let A=()=>{let ne=window.matchMedia("(max-width: 768px)").matches;ne!==J&&Ae(ne)};return A(),window.addEventListener("resize",A),()=>{window.removeEventListener("resize",A)}},[J]);let L=["field-type",re,r,$&&"error",q&&`${re}--read-only`,t?.admin?.hideGutter!==!0&&!J?`${re}--show-gutter`:null].filter(Boolean).join(" "),P=`${k}.${C}`,ue=$e(),we=Ht(A=>{ue(()=>{let Oe=A.toJSON();F.current=Oe,I(Oe)})},[I,ue]),Yt=Ln(()=>kn(o),[o]),Gt=Rn(A=>{F.current!==T&&!vn(F.current!=null?JSON.parse(JSON.stringify(F.current)):F.current,T)&&(de.current=A,F.current=T,Me(new Date))});return Vt(()=>{Object.is(w,de.current)||Gt(w)},[w]),ce("div",{"aria-label":bn(s||"",g),className:L,"data-field-path":k,"data-field-schemapath":a,"data-lexical-view":t?.view,role:"group",style:Yt,children:[ce("div",{className:`${re}__label-row`,children:[B||v(Nn,{hasRequiredAccessibleState:!0,label:s,localized:l,path:k,required:d}),!x&&v(Kt,{})]}),ce("div",{className:`${re}__wrap`,children:[v(jt,{CustomComponent:_,Fallback:v(En,{path:k,showError:$})}),ce(An,{fallbackRender:On,onReset:()=>{},children:[S,v("div",{className:`${re}__editor-content`,children:v(xn,{modalSlugPrefix:`lexical-${k}`,children:v($t,{composerKey:P,editorConfig:t,fieldProps:e,isSmallWidthViewport:J,onChange:we,readOnly:q,rtl:h,value:T},JSON.stringify({path:k,rerenderProviderKey:Se}))})}),b]}),v(jt,{CustomComponent:D,Fallback:v(Cn,{description:n,path:k})})]})]},P)};function On({error:e}){return ce("div",{className:"errorBoundary",role:"alert",children:[v("p",{children:"Something went wrong:"}),v("pre",{style:{color:"red"},children:e instanceof Error?e.message:String(e)})]})}var na=Mn;export{na as RichText};
2
- //# sourceMappingURL=Field-2HOFHTFX.js.map