@payloadcms/richtext-lexical 3.80.0-internal.60d6f94 → 3.80.0-internal.82dcece

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 (163) hide show
  1. package/dist/exports/client/Field-OIMYWB22.js +2 -0
  2. package/dist/exports/client/Field-OIMYWB22.js.map +7 -0
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/chunk-2S5Q7QYO.js +2 -0
  5. package/dist/exports/client/chunk-2S5Q7QYO.js.map +7 -0
  6. package/dist/exports/client/chunk-EZX4YW7S.js +12 -0
  7. package/dist/exports/client/chunk-EZX4YW7S.js.map +7 -0
  8. package/dist/exports/client/componentInline-NL25DNZ5.js +2 -0
  9. package/dist/exports/client/index.d.ts +0 -1
  10. package/dist/exports/client/index.d.ts.map +1 -1
  11. package/dist/exports/client/index.js +23 -23
  12. package/dist/exports/client/index.js.map +3 -3
  13. package/dist/exports/react/index.d.ts +1 -3
  14. package/dist/exports/react/index.d.ts.map +1 -1
  15. package/dist/exports/react/index.js +0 -1
  16. package/dist/exports/react/index.js.map +1 -1
  17. package/dist/features/blocks/client/component/BlockContent.d.ts +4 -7
  18. package/dist/features/blocks/client/component/BlockContent.d.ts.map +1 -1
  19. package/dist/features/blocks/client/component/BlockContent.js +8 -9
  20. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  21. package/dist/features/blocks/client/component/index.d.ts +4 -20
  22. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  23. package/dist/features/blocks/client/component/index.js +55 -112
  24. package/dist/features/blocks/client/component/index.js.map +1 -1
  25. package/dist/features/blocks/client/componentInline/index.d.ts +14 -8
  26. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  27. package/dist/features/blocks/client/componentInline/index.js +18 -67
  28. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  29. package/dist/features/blocks/client/nodes/BlocksNode.d.ts +2 -4
  30. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  31. package/dist/features/blocks/client/nodes/BlocksNode.js +1 -3
  32. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  33. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts +2 -4
  34. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  35. package/dist/features/blocks/client/nodes/InlineBlocksNode.js +1 -3
  36. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  37. package/dist/features/converters/lexicalToHtml/async/converters/heading.d.ts.map +1 -1
  38. package/dist/features/converters/lexicalToHtml/async/converters/heading.js +3 -1
  39. package/dist/features/converters/lexicalToHtml/async/converters/heading.js.map +1 -1
  40. package/dist/features/converters/lexicalToHtml/async/converters/link.d.ts.map +1 -1
  41. package/dist/features/converters/lexicalToHtml/async/converters/link.js +7 -2
  42. package/dist/features/converters/lexicalToHtml/async/converters/link.js.map +1 -1
  43. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts.map +1 -1
  44. package/dist/features/converters/lexicalToHtml/async/converters/list.js +5 -1
  45. package/dist/features/converters/lexicalToHtml/async/converters/list.js.map +1 -1
  46. package/dist/features/converters/lexicalToHtml/async/converters/table.d.ts.map +1 -1
  47. package/dist/features/converters/lexicalToHtml/async/converters/table.js +2 -1
  48. package/dist/features/converters/lexicalToHtml/async/converters/table.js.map +1 -1
  49. package/dist/features/converters/lexicalToHtml/async/converters/text.d.ts.map +1 -1
  50. package/dist/features/converters/lexicalToHtml/async/converters/text.js +2 -1
  51. package/dist/features/converters/lexicalToHtml/async/converters/text.js.map +1 -1
  52. package/dist/features/converters/lexicalToHtml/async/converters/upload.d.ts.map +1 -1
  53. package/dist/features/converters/lexicalToHtml/async/converters/upload.js +11 -10
  54. package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
  55. package/dist/features/converters/lexicalToHtml/shared/cssColors.d.ts +5 -0
  56. package/dist/features/converters/lexicalToHtml/shared/cssColors.d.ts.map +1 -0
  57. package/dist/features/converters/lexicalToHtml/shared/cssColors.js +8 -0
  58. package/dist/features/converters/lexicalToHtml/shared/cssColors.js.map +1 -0
  59. package/dist/features/converters/lexicalToHtml/sync/converters/heading.d.ts.map +1 -1
  60. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js +3 -1
  61. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js.map +1 -1
  62. package/dist/features/converters/lexicalToHtml/sync/converters/link.d.ts.map +1 -1
  63. package/dist/features/converters/lexicalToHtml/sync/converters/link.js +7 -2
  64. package/dist/features/converters/lexicalToHtml/sync/converters/link.js.map +1 -1
  65. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts.map +1 -1
  66. package/dist/features/converters/lexicalToHtml/sync/converters/list.js +5 -1
  67. package/dist/features/converters/lexicalToHtml/sync/converters/list.js.map +1 -1
  68. package/dist/features/converters/lexicalToHtml/sync/converters/table.d.ts.map +1 -1
  69. package/dist/features/converters/lexicalToHtml/sync/converters/table.js +2 -1
  70. package/dist/features/converters/lexicalToHtml/sync/converters/table.js.map +1 -1
  71. package/dist/features/converters/lexicalToHtml/sync/converters/text.d.ts.map +1 -1
  72. package/dist/features/converters/lexicalToHtml/sync/converters/text.js +2 -1
  73. package/dist/features/converters/lexicalToHtml/sync/converters/text.js.map +1 -1
  74. package/dist/features/converters/lexicalToHtml/sync/converters/upload.d.ts.map +1 -1
  75. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js +11 -10
  76. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
  77. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +20 -6
  78. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  79. package/dist/features/converters/lexicalToJSX/Component/index.js +5 -7
  80. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  81. package/dist/features/converters/lexicalToJSX/converter/index.d.ts +2 -17
  82. package/dist/features/converters/lexicalToJSX/converter/index.d.ts.map +1 -1
  83. package/dist/features/converters/lexicalToJSX/converter/index.js +4 -124
  84. package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
  85. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +10 -14
  86. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  87. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  88. package/dist/features/debug/jsxConverter/client/plugin/index.js +1 -1
  89. package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
  90. package/dist/field/Diff/converters/link.d.ts.map +1 -1
  91. package/dist/field/Diff/converters/link.js +7 -2
  92. package/dist/field/Diff/converters/link.js.map +1 -1
  93. package/dist/field/Field.d.ts.map +1 -1
  94. package/dist/field/Field.js +19 -19
  95. package/dist/field/Field.js.map +1 -1
  96. package/dist/field/bundled.css +1 -1
  97. package/dist/field/index.d.ts +0 -1
  98. package/dist/field/index.d.ts.map +1 -1
  99. package/dist/field/index.js +35 -64
  100. package/dist/field/index.js.map +1 -1
  101. package/dist/field/rscEntry.d.ts +1 -1
  102. package/dist/field/rscEntry.d.ts.map +1 -1
  103. package/dist/field/rscEntry.js +0 -12
  104. package/dist/field/rscEntry.js.map +1 -1
  105. package/dist/index.d.ts +1 -1
  106. package/dist/index.d.ts.map +1 -1
  107. package/dist/index.js +1 -3
  108. package/dist/index.js.map +1 -1
  109. package/dist/lexical/LexicalEditor.d.ts +1 -1
  110. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  111. package/dist/lexical/LexicalEditor.js +9 -7
  112. package/dist/lexical/LexicalEditor.js.map +1 -1
  113. package/dist/lexical/LexicalProvider.d.ts +1 -0
  114. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  115. package/dist/lexical/LexicalProvider.js +6 -13
  116. package/dist/lexical/LexicalProvider.js.map +1 -1
  117. package/dist/lexical/config/client/sanitize.d.ts +1 -1
  118. package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
  119. package/dist/lexical/config/client/sanitize.js +2 -3
  120. package/dist/lexical/config/client/sanitize.js.map +1 -1
  121. package/dist/lexical/config/types.d.ts +0 -4
  122. package/dist/lexical/config/types.d.ts.map +1 -1
  123. package/dist/lexical/config/types.js.map +1 -1
  124. package/dist/lexical/nodes/index.d.ts +2 -12
  125. package/dist/lexical/nodes/index.d.ts.map +1 -1
  126. package/dist/lexical/nodes/index.js +2 -213
  127. package/dist/lexical/nodes/index.js.map +1 -1
  128. package/dist/lexical/plugins/SlashMenu/index.d.ts.map +1 -1
  129. package/dist/lexical/plugins/SlashMenu/index.js +1 -14
  130. package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
  131. package/dist/types.d.ts +2 -329
  132. package/dist/types.d.ts.map +1 -1
  133. package/dist/types.js.map +1 -1
  134. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  135. package/dist/utilities/generateImportMap.js +0 -1
  136. package/dist/utilities/generateImportMap.js.map +1 -1
  137. package/dist/validate/hasText.d.ts +1 -6
  138. package/dist/validate/hasText.d.ts.map +1 -1
  139. package/dist/validate/hasText.js +4 -10
  140. package/dist/validate/hasText.js.map +1 -1
  141. package/package.json +6 -11
  142. package/dist/exports/client/Field-ESDONIMD.js +0 -2
  143. package/dist/exports/client/Field-ESDONIMD.js.map +0 -7
  144. package/dist/exports/client/chunk-VCJQ5B3S.js +0 -12
  145. package/dist/exports/client/chunk-VCJQ5B3S.js.map +0 -7
  146. package/dist/exports/client/chunk-YWIZCGSY.js +0 -2
  147. package/dist/exports/client/chunk-YWIZCGSY.js.map +0 -7
  148. package/dist/exports/client/componentInline-CBBUBQ7P.js +0 -2
  149. package/dist/exports/client/internal-client.d.ts +0 -3
  150. package/dist/exports/client/internal-client.d.ts.map +0 -1
  151. package/dist/field/RichTextViewProvider.d.ts +0 -86
  152. package/dist/field/RichTextViewProvider.d.ts.map +0 -1
  153. package/dist/field/RichTextViewProvider.js +0 -90
  154. package/dist/field/RichTextViewProvider.js.map +0 -1
  155. package/dist/field/ViewSelector.d.ts +0 -4
  156. package/dist/field/ViewSelector.d.ts.map +0 -1
  157. package/dist/field/ViewSelector.js +0 -89
  158. package/dist/field/ViewSelector.js.map +0 -1
  159. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts +0 -2
  160. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts.map +0 -1
  161. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js +0 -48
  162. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +0 -1
  163. /package/dist/exports/client/{componentInline-CBBUBQ7P.js.map → componentInline-NL25DNZ5.js.map} +0 -0
package/dist/types.d.ts CHANGED
@@ -1,24 +1,9 @@
1
- import type { DecoratorNode, EditorConfig, LexicalEditor, EditorConfig as LexicalEditorConfig, LexicalNode, SerializedEditorState, SerializedLexicalNode } from 'lexical';
2
- import type { ClientField, DefaultServerCellComponentProps, LabelFunction, PayloadComponent, RichTextAdapter, RichTextField, RichTextFieldClient, RichTextFieldClientProps, SanitizedConfig, ServerFieldBase, StaticLabel } from 'payload';
3
- import type { BlockComponentContextType } from './features/blocks/client/component/BlockContent.js';
4
- export type { BlockComponentContextType };
5
- import type { BlockComponentProps } from './features/blocks/client/component/index.js';
6
- import type { InlineBlockComponentContextType } from './features/blocks/client/componentInline/index.js';
7
- import type { JSXConverterArgs, JSXConverters, SerializedLexicalNodeWithParent } from './features/converters/lexicalToJSX/converter/types.js';
1
+ import type { EditorConfig as LexicalEditorConfig, SerializedEditorState } from 'lexical';
2
+ import type { ClientField, DefaultServerCellComponentProps, LabelFunction, RichTextAdapter, RichTextField, RichTextFieldClient, RichTextFieldClientProps, SanitizedConfig, ServerFieldBase, StaticLabel } from 'payload';
8
3
  import type { BaseClientFeatureProps, FeatureProviderProviderClient } from './features/typesClient.js';
9
4
  import type { FeatureProviderServer } from './features/typesServer.js';
10
5
  import type { SanitizedServerEditorConfig } from './lexical/config/types.js';
11
- import type { DefaultNodeTypes, SerializedBlockNode, SerializedInlineBlockNode } from './nodeTypes.js';
12
6
  import type { InitialLexicalFormState } from './utilities/buildInitialState.js';
13
- /**
14
- * Base constraint for serialized Lexical node types.
15
- * Used as the generic constraint for node map types.
16
- * Extends the base SerializedLexicalNode with optional type for flexibility.
17
- */
18
- export type SerializedNodeBase = {
19
- [key: string]: unknown;
20
- type?: string;
21
- };
22
7
  export type LexicalFieldAdminProps = {
23
8
  /**
24
9
  * Controls if the add block button should be hidden. @default false
@@ -71,321 +56,10 @@ export type FeaturesInput = (({ defaultFeatures, rootFeatures, }: {
71
56
  */
72
57
  rootFeatures: FeatureProviderServer<any, any, any>[];
73
58
  }) => FeatureProviderServer<any, any, any>[]) | FeatureProviderServer<any, any, any>[];
74
- type WithinEditorArgs = {
75
- config: EditorConfig;
76
- editor: LexicalEditor;
77
- node: LexicalNode;
78
- };
79
- /**
80
- *
81
- * @experimental - This API is experimental and may change in a minor release.
82
- * @internal
83
- */
84
- export type NodeMapValue<TNode extends SerializedNodeBase = SerializedLexicalNode> = {
85
- /**
86
- * Provide a react component to render the node.
87
- *
88
- * **JSX Converter:** Always works. Takes priority over `html`.
89
- *
90
- * **Lexical Editor:** Only works for DecoratorNodes (renders in `decorate` method). Takes priority over `html` and `createDOM`.
91
- */
92
- Component?: (args: ({
93
- isEditor: false;
94
- isJSXConverter: true;
95
- } & JSXConverterArgs<TNode>) | ({
96
- isEditor: true;
97
- isJSXConverter: false;
98
- node: {
99
- _originalDecorate?: (editor: LexicalEditor, config: EditorConfig) => React.ReactNode;
100
- } & DecoratorNode<React.ReactNode>;
101
- } & Omit<WithinEditorArgs, 'node'>)) => React.ReactNode;
102
- /**
103
- * Provide a function to create the DOM element for the node.
104
- *
105
- * **JSX Converter:** Not used (only `Component` and `html` work).
106
- *
107
- * **Lexical Editor:** Always works (renders in `createDOM` method).
108
- * - For ElementNodes: This is the standard way to customize rendering.
109
- * - For DecoratorNodes: When combined with `html`, the DOM gets custom structure while `decorate` renders the `html` content.
110
- */
111
- createDOM?: (args: WithinEditorArgs) => HTMLElement;
112
- /**
113
- * Provide HTML string or function to render the node.
114
- *
115
- * **JSX Converter:** Always works (ignored if `Component` is provided).
116
- *
117
- * **Lexical Editor behavior depends on node type:**
118
- *
119
- * - **ElementNodes:** `html` is used in `createDOM` to generate the DOM structure.
120
- *
121
- * - **DecoratorNodes (have both `createDOM` and `decorate`):**
122
- * - If only `html` is provided: `createDOM` uses `html` to create DOM, `decorate` returns `null`
123
- * - If `html` + `Component`: `createDOM` uses `html`, `decorate` uses `Component`
124
- * - If `html` + `createDOM`: Custom `createDOM` creates structure, `decorate` renders `html` content
125
- * - If `html` + `Component` + `createDOM`: Custom `createDOM` creates structure, `decorate` uses `Component` (html ignored in editor)
126
- */
127
- html?: (args: ({
128
- isEditor: false;
129
- isJSXConverter: true;
130
- } & JSXConverterArgs<TNode>) | ({
131
- isEditor: true;
132
- isJSXConverter: false;
133
- } & WithinEditorArgs)) => string;
134
- };
135
- type SharedViewMapBlockEditorProps<TNode extends SerializedBlockNode | SerializedInlineBlockNode> = {
136
- /**
137
- * True when rendering in the admin editor.
138
- */
139
- isEditor: true;
140
- /**
141
- * False when rendering in the admin editor.
142
- */
143
- isJSXConverter: false;
144
- } & Pick<BlockComponentProps<TNode['fields']>, 'className' | 'formData' | 'nodeKey'>;
145
- /**
146
- * Props passed to a custom Block component in editor mode.
147
- * Use `isEditor` to discriminate between editor and JSX converter modes.
148
- *
149
- * @experimental - This API is experimental and may change in a minor release.
150
- */
151
- export type ViewMapBlockEditorProps<TNode extends SerializedBlockNode> = {
152
- /**
153
- * Hook to access block UI components (BlockCollapsible, EditButton, etc.).
154
- * Call this inside your component to get the context values.
155
- * Passed as a prop so you don't need to import from @payloadcms/richtext-lexical/client.
156
- */
157
- useBlockComponentContext: () => BlockComponentContextType;
158
- } & SharedViewMapBlockEditorProps<TNode>;
159
- /**
160
- * Props passed to a custom Block component in editor mode.
161
- * Use `isEditor` to discriminate between editor and JSX converter modes.
162
- *
163
- * @experimental - This API is experimental and may change in a minor release.
164
- */
165
- export type ViewMapInlineBlockEditorProps<TNode extends SerializedInlineBlockNode> = {
166
- useInlineBlockComponentContext: () => InlineBlockComponentContextType;
167
- } & SharedViewMapBlockEditorProps<TNode>;
168
- /**
169
- * Props passed to a custom Block component in JSX converter mode (frontend).
170
- * Use `isEditor` to discriminate between editor and JSX converter modes.
171
- *
172
- * @experimental - This API is experimental and may change in a minor release.
173
- */
174
- export type ViewMapBlockJSXConverterProps<TNode extends SerializedBlockNode | SerializedInlineBlockNode = SerializedBlockNode | SerializedInlineBlockNode> = {
175
- /**
176
- * Index of this node among its siblings.
177
- */
178
- childIndex: number;
179
- /**
180
- * Available JSX converters for nested content.
181
- */
182
- converters: JSXConverters;
183
- /**
184
- * The block's form data (field values).
185
- */
186
- formData: TNode['fields'];
187
- /**
188
- * False when rendering via JSX converter (frontend).
189
- */
190
- isEditor: false;
191
- /**
192
- * True when rendering via JSX converter (frontend).
193
- */
194
- isJSXConverter: true;
195
- /**
196
- * The serialized block node.
197
- */
198
- node: TNode;
199
- /**
200
- * Function to convert child nodes to JSX.
201
- */
202
- nodesToJSX: (args: {
203
- converters?: JSXConverters;
204
- disableIndent?: boolean | string[];
205
- disableTextAlign?: boolean | string[];
206
- nodes: SerializedLexicalNode[];
207
- parent?: SerializedLexicalNodeWithParent;
208
- }) => React.ReactNode[];
209
- /**
210
- * The parent node in the tree.
211
- */
212
- parent: SerializedLexicalNodeWithParent;
213
- };
214
- /**
215
- * Props passed to a custom Block component in a view map.
216
- * This is a discriminated union - use `isEditor` to narrow the type.
217
- *
218
- * When `isEditor` is true, you're in the admin editor with access to `blockContext`.
219
- * When `isEditor` is false, you're in the frontend JSX converter with `nodesToJSX`.
220
- *
221
- * @example
222
- * ```tsx
223
- * const MyBlock: React.FC<ViewMapBlockComponentProps> = (props) => {
224
- * if (props.isEditor) {
225
- * // Admin editor - blockContext available
226
- * const { BlockCollapsible, EditButton } = props.blockContext
227
- * return <BlockCollapsible>{props.formData.title}</BlockCollapsible>
228
- * }
229
- * // Frontend - readonly render
230
- * return <div>{props.formData.title}</div>
231
- * }
232
- * ```
233
- *
234
- * @experimental - This API is experimental and may change in a minor release.
235
- */
236
- export type ViewMapBlockComponentProps<TNode extends SerializedBlockNode = SerializedBlockNode> = ViewMapBlockEditorProps<TNode> | ViewMapBlockJSXConverterProps<TNode>;
237
- export type ViewMapInlineBlockComponentProps<TNode extends SerializedInlineBlockNode = SerializedInlineBlockNode> = ViewMapBlockJSXConverterProps<TNode> | ViewMapInlineBlockEditorProps<TNode>;
238
- /**
239
- *
240
- * @experimental - This API is experimental and may change in a minor release.
241
- * @internal
242
- */
243
- export type NodeMapBlockValue<TNode extends SerializedBlockNode = SerializedBlockNode> = {
244
- /**
245
- * A React component that replaces the entire block, including the header/collapsible.
246
- * Works for both admin editor and frontend JSX conversion.
247
- *
248
- * Use `isEditor` to discriminate between modes:
249
- * - Editor mode: `blockContext` is available with UI components (BlockCollapsible, EditButton, etc.)
250
- * - JSX converter mode: `nodesToJSX` is available for rendering nested content
251
- *
252
- * @example
253
- * ```tsx
254
- * Block: (props) => {
255
- * if (props.isEditor) {
256
- * const { BlockCollapsible } = props.blockContext
257
- * return <BlockCollapsible>{props.formData.title}</BlockCollapsible>
258
- * }
259
- * return <div>{props.formData.title}</div>
260
- * }
261
- * ```
262
- */
263
- Block?: React.FC<ViewMapBlockComponentProps<TNode>>;
264
- /**
265
- * A React component that replaces the block label.
266
- * Use `useBlockComponentContext()` hook to access block context.
267
- */
268
- Label?: React.FC<ViewMapBlockComponentProps<TNode>>;
269
- } & Pick<NodeMapValue<TNode>, 'Component' | 'createDOM' | 'html'>;
270
- export type NodeMapInlineBlockValue<TNode extends SerializedInlineBlockNode = SerializedInlineBlockNode> = {
271
- /**
272
- * A React component that replaces the entire block, including the header/collapsible.
273
- * Works for both admin editor and frontend JSX conversion.
274
- *
275
- * Use `isEditor` to discriminate between modes:
276
- * - Editor mode: `blockContext` is available with UI components (BlockCollapsible, EditButton, etc.)
277
- * - JSX converter mode: `nodesToJSX` is available for rendering nested content
278
- *
279
- * @example
280
- * ```tsx
281
- * InlineBlock: (props) => {
282
- * if (props.isEditor) {
283
- * const { BlockCollapsible } = props.blockContext
284
- * return <BlockCollapsible>{props.formData.title}</BlockCollapsible>
285
- * }
286
- * return <div>{props.formData.title}</div>
287
- * }
288
- * ```
289
- */
290
- Block?: React.FC<ViewMapInlineBlockComponentProps<TNode>>;
291
- /**
292
- * A React component that replaces the block label.
293
- * Use `useBlockComponentContext()` hook to access block context.
294
- */
295
- Label?: React.FC<ViewMapInlineBlockComponentProps<TNode>>;
296
- } & Pick<NodeMapValue<TNode>, 'Component' | 'createDOM' | 'html'>;
297
- /**
298
- * @experimental - This API is experimental and may change in a minor release.
299
- * @internal
300
- */
301
- export type LexicalEditorNodeMap<TNodes extends SerializedNodeBase = DefaultNodeTypes | SerializedBlockNode<{
302
- blockName?: null | string;
303
- blockType: string;
304
- }> | SerializedInlineBlockNode<{
305
- blockName?: null | string;
306
- blockType: string;
307
- }>> = {
308
- [key: string]: {
309
- [blockSlug: string]: NodeMapBlockValue<any> | NodeMapInlineBlockValue<any>;
310
- } | NodeMapValue<any> | undefined;
311
- } & {
312
- [nodeType in Exclude<NonNullable<TNodes['type']>, 'block' | 'inlineBlock'>]?: NodeMapValue<Extract<TNodes, {
313
- type: nodeType;
314
- }>>;
315
- } & {
316
- blocks?: {
317
- [K in Extract<Extract<TNodes, {
318
- type: 'block';
319
- }> extends SerializedBlockNode<infer B> ? B extends {
320
- blockType: string;
321
- } ? B['blockType'] : never : never, string>]?: NodeMapBlockValue<Extract<TNodes, {
322
- type: 'block';
323
- }> extends SerializedBlockNode<infer B> ? SerializedBlockNode<Extract<B, {
324
- blockType: K;
325
- }>> : SerializedBlockNode>;
326
- };
327
- inlineBlocks?: {
328
- [K in Extract<Extract<TNodes, {
329
- type: 'inlineBlock';
330
- }> extends SerializedInlineBlockNode<infer B> ? B extends {
331
- blockType: string;
332
- } ? B['blockType'] : never : never, string>]?: NodeMapInlineBlockValue<Extract<TNodes, {
333
- type: 'inlineBlock';
334
- }> extends SerializedInlineBlockNode<infer B> ? SerializedInlineBlockNode<Extract<B, {
335
- blockType: K;
336
- }>> : SerializedInlineBlockNode>;
337
- };
338
- unknown?: NodeMapValue<SerializedLexicalNode>;
339
- };
340
- /**
341
- * A map of views, which can be used to render the editor in different ways.
342
- *
343
- * In order to override the default view, you can add a `default` key to the map.
344
- *
345
- * @experimental - This API is experimental and may change in a minor release.
346
- * @internal
347
- */
348
- export type LexicalEditorViewMap<TNodes extends SerializedNodeBase = DefaultNodeTypes | SerializedBlockNode<{
349
- blockName?: null | string;
350
- blockType: string;
351
- }> | SerializedInlineBlockNode<{
352
- blockName?: null | string;
353
- blockType: string;
354
- }>> = {
355
- [viewKey: string]: {
356
- admin?: LexicalFieldAdminClientProps;
357
- /**
358
- * Lexical editor configuration. Can be an object or a function that receives the default config.
359
- * Using a function avoids needing to import defaultEditorLexicalConfig.
360
- *
361
- * @example
362
- * ```ts
363
- * lexical: (defaultConfig) => ({
364
- * ...defaultConfig,
365
- * theme: { ...defaultConfig.theme, paragraph: 'my-paragraph' },
366
- * })
367
- * ```
368
- */
369
- lexical?: ((defaultConfig: LexicalEditorConfig) => LexicalEditorConfig) | LexicalEditorConfig;
370
- nodes: LexicalEditorNodeMap<TNodes>;
371
- };
372
- };
373
- /**
374
- * @todo rename to LexicalEditorArgs in 4.0, since these are arguments for the lexicalEditor function
375
- */
376
59
  export type LexicalEditorProps = {
377
60
  admin?: LexicalFieldAdminProps;
378
61
  features?: FeaturesInput;
379
62
  lexical?: LexicalEditorConfig;
380
- /**
381
- * A path to a LexicalEditorViewMap, which can be used to render the editor in different ways.
382
- *
383
- * In order to override the default view, you can add a `default` key to the map.
384
- *
385
- * @experimental - This API is experimental and may change in a minor release.
386
- * @internal
387
- */
388
- views?: PayloadComponent;
389
63
  };
390
64
  export type LexicalRichTextAdapter = {
391
65
  editorConfig: SanitizedServerEditorConfig;
@@ -422,7 +96,6 @@ export type LexicalRichTextFieldProps = {
422
96
  featureClientSchemaMap: FeatureClientSchemaMap;
423
97
  initialLexicalFormState: InitialLexicalFormState;
424
98
  lexicalEditorConfig: LexicalEditorConfig | undefined;
425
- views?: LexicalEditorViewMap;
426
99
  } & Pick<ServerFieldBase, 'permissions'> & RichTextFieldClientProps<SerializedEditorState, AdapterProps, object>;
427
100
  export type LexicalRichTextCellProps = DefaultServerCellComponentProps<RichTextFieldClient<SerializedEditorState, AdapterProps, object>, SerializedEditorState>;
428
101
  export type AdapterProps = {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,aAAa,EACb,YAAY,IAAI,mBAAmB,EACnC,WAAW,EACX,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EACV,WAAW,EACX,+BAA+B,EAC/B,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,WAAW,EACZ,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAA;AACnG,YAAY,EAAE,yBAAyB,EAAE,CAAA;AACzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAA;AACtF,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,mDAAmD,CAAA;AACxG,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACb,+BAA+B,EAChC,MAAM,uDAAuD,CAAA;AAC9D,OAAO,KAAK,EACV,sBAAsB,EACtB,6BAA6B,EAC9B,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AACtE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAA;AAC5E,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB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ED,MAAM,MAAM,oBAAoB,GAAG,aAAa,CAAC,qBAAqB,EAAE,YAAY,CAAC,CAAA"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../src/types.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 {\n DefaultNodeTypes,\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from './nodeTypes.js'\nimport type { InitialLexicalFormState } from './utilities/buildInitialState.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 = { [key: string]: unknown; 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<\n Extract<TNodes, { type: 'block' }> extends SerializedBlockNode<infer B>\n ? B extends { blockType: string }\n ? B['blockType']\n : never\n : never,\n string\n >]?: NodeMapBlockValue<\n Extract<TNodes, { type: 'block' }> extends SerializedBlockNode<infer B>\n ? SerializedBlockNode<Extract<B, { blockType: K }>>\n : SerializedBlockNode\n >\n }\n inlineBlocks?: {\n [K in Extract<\n Extract<TNodes, { type: 'inlineBlock' }> extends SerializedInlineBlockNode<infer B>\n ? B extends { blockType: string }\n ? B['blockType']\n : never\n : never,\n string\n >]?: NodeMapInlineBlockValue<\n Extract<TNodes, { type: 'inlineBlock' }> extends SerializedInlineBlockNode<infer B>\n ? SerializedInlineBlockNode<Extract<B, { blockType: K }>>\n : SerializedInlineBlockNode\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 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 * 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 }) => Promise<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: {\n [featureKey: string]: {\n clientFeatureProps?: BaseClientFeatureProps<Record<string, any>>\n clientFeatureProvider?: FeatureProviderProviderClient<any, any>\n }\n }\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 // 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":"AAmhBA","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type { EditorConfig as LexicalEditorConfig, SerializedEditorState } from 'lexical'\nimport type {\n ClientField,\n DefaultServerCellComponentProps,\n LabelFunction,\n RichTextAdapter,\n RichTextField,\n RichTextFieldClient,\n RichTextFieldClientProps,\n SanitizedConfig,\n ServerFieldBase,\n StaticLabel,\n} from 'payload'\n\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'\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\nexport type LexicalEditorProps = {\n admin?: LexicalFieldAdminProps\n features?: FeaturesInput\n lexical?: LexicalEditorConfig\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 }) => Promise<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: {\n [featureKey: string]: {\n clientFeatureProps?: BaseClientFeatureProps<Record<string, any>>\n clientFeatureProvider?: FeatureProviderProviderClient<any, any>\n }\n }\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 // Undefined if default lexical editor config should be used\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":"AAoJA","ignoreList":[]}
@@ -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,aAAa,CAAA;AAErD,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,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAErD,eAAO,MAAM,oBAAoB,SACxB;IACL,iBAAiB,CAAC,EAAE,kBAAkB,CAAA;IACtC,kBAAkB,EAAE,wBAAwB,CAAA;CAC7C,KAAG,eAAe,CAAC,mBAAmB,CA+CtC,CAAA"}
@@ -9,7 +9,6 @@ export const getGenerateImportMap = args => ({
9
9
  addToImportMap('@payloadcms/richtext-lexical/rsc#RscEntryLexicalCell');
10
10
  addToImportMap('@payloadcms/richtext-lexical/rsc#RscEntryLexicalField');
11
11
  addToImportMap('@payloadcms/richtext-lexical/rsc#LexicalDiffComponent');
12
- addToImportMap(args.lexicalEditorArgs?.views);
13
12
  for (const resolvedFeature of args.resolvedFeatureMap.values()) {
14
13
  if ('componentImports' in resolvedFeature) {
15
14
  if (typeof resolvedFeature.componentImports === 'function') {
@@ -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.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","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.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 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;EAEf,KAAK,MAAMK,eAAA,IAAmBN,IAAA,CAAKO,kBAAkB,CAACC,MAAM,IAAI;IAC9D,IAAI,sBAAsBF,eAAA,EAAiB;MACzC,IAAI,OAAOA,eAAA,CAAgBG,gBAAgB,KAAK,YAAY;QAC1DH,eAAA,CAAgBG,gBAAgB,CAAC;UAC/BR,cAAA;UACAC,OAAA;UACAC,MAAA;UACAC,SAAA;UACAC;QACF;MACF,OAAO,IAAIK,KAAA,CAAMC,OAAO,CAACL,eAAA,CAAgBG,gBAAgB,GAAG;QAC1DR,cAAA,CAAeK,eAAA,CAAgBG,gBAAgB;MACjD,OAAO,IAAI,OAAOH,eAAA,CAAgBG,gBAAgB,KAAK,UAAU;QAC/DR,cAAA,CAAeW,MAAA,CAAOJ,MAAM,CAACF,eAAA,CAAgBG,gBAAgB;MAC/D;IACF;IAEAR,cAAA,CAAeK,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;UACrBjB,yBAAA,CAA0B;YACxBG,cAAA;YACAC,OAAA;YACAC,MAAA;YACAgB,MAAA,EAAQD,SAAA;YACRd,SAAA;YACAC;UACF;QACF;MACF;IACF;EACF;AACF","ignoreList":[]}
@@ -1,8 +1,3 @@
1
1
  import type { SerializedEditorState, SerializedLexicalNode } from 'lexical';
2
- /**
3
- * This function checks if the editor state is empty (has any text). If the editor state has no nodes,
4
- * or only an empty paragraph node (no TextNode with length > 0), it returns false.
5
- * Otherwise, it returns true.
6
- */
7
- export declare function hasText(value: null | SerializedEditorState<SerializedLexicalNode> | undefined): value is SerializedEditorState<SerializedLexicalNode>;
2
+ export declare function hasText(value: null | SerializedEditorState<SerializedLexicalNode> | undefined): boolean;
8
3
  //# sourceMappingURL=hasText.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hasText.d.ts","sourceRoot":"","sources":["../../src/validate/hasText.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EAGtB,MAAM,SAAS,CAAA;AAEhB;;;;GAIG;AACH,wBAAgB,OAAO,CACrB,KAAK,EAAE,IAAI,GAAG,qBAAqB,CAAC,qBAAqB,CAAC,GAAG,SAAS,GACrE,KAAK,IAAI,qBAAqB,CAAC,qBAAqB,CAAC,CA6BvD"}
1
+ {"version":3,"file":"hasText.d.ts","sourceRoot":"","sources":["../../src/validate/hasText.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EAGtB,MAAM,SAAS,CAAA;AAEhB,wBAAgB,OAAO,CACrB,KAAK,EAAE,IAAI,GAAG,qBAAqB,CAAC,qBAAqB,CAAC,GAAG,SAAS,GACrE,OAAO,CA0BT"}
@@ -1,12 +1,5 @@
1
- /**
2
- * This function checks if the editor state is empty (has any text). If the editor state has no nodes,
3
- * or only an empty paragraph node (no TextNode with length > 0), it returns false.
4
- * Otherwise, it returns true.
5
- */export function hasText(value) {
1
+ export function hasText(value) {
6
2
  const hasChildren = !!value?.root?.children?.length;
7
- if (!hasChildren) {
8
- return false;
9
- }
10
3
  let hasOnlyEmptyParagraph = false;
11
4
  if (value?.root?.children?.length === 1) {
12
5
  if (value?.root?.children[0]?.type === 'paragraph') {
@@ -23,9 +16,10 @@
23
16
  }
24
17
  }
25
18
  }
26
- if (hasOnlyEmptyParagraph) {
19
+ if (!hasChildren || hasOnlyEmptyParagraph) {
27
20
  return false;
21
+ } else {
22
+ return true;
28
23
  }
29
- return true;
30
24
  }
31
25
  //# sourceMappingURL=hasText.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hasText.js","names":["hasText","value","hasChildren","root","children","length","hasOnlyEmptyParagraph","type","paragraphNode","paragraphNodeChild"],"sources":["../../src/validate/hasText.ts"],"sourcesContent":["import type {\n SerializedEditorState,\n SerializedLexicalNode,\n SerializedParagraphNode,\n SerializedTextNode,\n} from 'lexical'\n\n/**\n * This function checks if the editor state is empty (has any text). If the editor state has no nodes,\n * or only an empty paragraph node (no TextNode with length > 0), it returns false.\n * Otherwise, it returns true.\n */\nexport function hasText(\n value: null | SerializedEditorState<SerializedLexicalNode> | undefined,\n): value is SerializedEditorState<SerializedLexicalNode> {\n const hasChildren = !!value?.root?.children?.length\n if (!hasChildren) {\n return false\n }\n\n let hasOnlyEmptyParagraph = false\n if (value?.root?.children?.length === 1) {\n if (value?.root?.children[0]?.type === 'paragraph') {\n const paragraphNode = value?.root?.children[0] as SerializedParagraphNode\n\n if (!paragraphNode?.children || paragraphNode?.children?.length === 0) {\n hasOnlyEmptyParagraph = true\n } else if (paragraphNode?.children?.length === 1) {\n const paragraphNodeChild = paragraphNode?.children[0]\n if (paragraphNodeChild?.type === 'text') {\n if (!(paragraphNodeChild as SerializedTextNode | undefined)?.['text']?.length) {\n hasOnlyEmptyParagraph = true\n }\n }\n }\n }\n }\n\n if (hasOnlyEmptyParagraph) {\n return false\n }\n\n return true\n}\n"],"mappings":"AAOA;;;;GAKA,OAAO,SAASA,QACdC,KAAsE;EAEtE,MAAMC,WAAA,GAAc,CAAC,CAACD,KAAA,EAAOE,IAAA,EAAMC,QAAA,EAAUC,MAAA;EAC7C,IAAI,CAACH,WAAA,EAAa;IAChB,OAAO;EACT;EAEA,IAAII,qBAAA,GAAwB;EAC5B,IAAIL,KAAA,EAAOE,IAAA,EAAMC,QAAA,EAAUC,MAAA,KAAW,GAAG;IACvC,IAAIJ,KAAA,EAAOE,IAAA,EAAMC,QAAQ,CAAC,EAAE,EAAEG,IAAA,KAAS,aAAa;MAClD,MAAMC,aAAA,GAAgBP,KAAA,EAAOE,IAAA,EAAMC,QAAQ,CAAC,EAAE;MAE9C,IAAI,CAACI,aAAA,EAAeJ,QAAA,IAAYI,aAAA,EAAeJ,QAAA,EAAUC,MAAA,KAAW,GAAG;QACrEC,qBAAA,GAAwB;MAC1B,OAAO,IAAIE,aAAA,EAAeJ,QAAA,EAAUC,MAAA,KAAW,GAAG;QAChD,MAAMI,kBAAA,GAAqBD,aAAA,EAAeJ,QAAQ,CAAC,EAAE;QACrD,IAAIK,kBAAA,EAAoBF,IAAA,KAAS,QAAQ;UACvC,IAAI,CAAEE,kBAAA,GAAwD,OAAO,EAAEJ,MAAA,EAAQ;YAC7EC,qBAAA,GAAwB;UAC1B;QACF;MACF;IACF;EACF;EAEA,IAAIA,qBAAA,EAAuB;IACzB,OAAO;EACT;EAEA,OAAO;AACT","ignoreList":[]}
1
+ {"version":3,"file":"hasText.js","names":["hasText","value","hasChildren","root","children","length","hasOnlyEmptyParagraph","type","paragraphNode","paragraphNodeChild"],"sources":["../../src/validate/hasText.ts"],"sourcesContent":["import type {\n SerializedEditorState,\n SerializedLexicalNode,\n SerializedParagraphNode,\n SerializedTextNode,\n} from 'lexical'\n\nexport function hasText(\n value: null | SerializedEditorState<SerializedLexicalNode> | undefined,\n): boolean {\n const hasChildren = !!value?.root?.children?.length\n\n let hasOnlyEmptyParagraph = false\n if (value?.root?.children?.length === 1) {\n if (value?.root?.children[0]?.type === 'paragraph') {\n const paragraphNode = value?.root?.children[0] as SerializedParagraphNode\n\n if (!paragraphNode?.children || paragraphNode?.children?.length === 0) {\n hasOnlyEmptyParagraph = true\n } else if (paragraphNode?.children?.length === 1) {\n const paragraphNodeChild = paragraphNode?.children[0]\n if (paragraphNodeChild?.type === 'text') {\n if (!(paragraphNodeChild as SerializedTextNode | undefined)?.['text']?.length) {\n hasOnlyEmptyParagraph = true\n }\n }\n }\n }\n }\n\n if (!hasChildren || hasOnlyEmptyParagraph) {\n return false\n } else {\n return true\n }\n}\n"],"mappings":"AAOA,OAAO,SAASA,QACdC,KAAsE;EAEtE,MAAMC,WAAA,GAAc,CAAC,CAACD,KAAA,EAAOE,IAAA,EAAMC,QAAA,EAAUC,MAAA;EAE7C,IAAIC,qBAAA,GAAwB;EAC5B,IAAIL,KAAA,EAAOE,IAAA,EAAMC,QAAA,EAAUC,MAAA,KAAW,GAAG;IACvC,IAAIJ,KAAA,EAAOE,IAAA,EAAMC,QAAQ,CAAC,EAAE,EAAEG,IAAA,KAAS,aAAa;MAClD,MAAMC,aAAA,GAAgBP,KAAA,EAAOE,IAAA,EAAMC,QAAQ,CAAC,EAAE;MAE9C,IAAI,CAACI,aAAA,EAAeJ,QAAA,IAAYI,aAAA,EAAeJ,QAAA,EAAUC,MAAA,KAAW,GAAG;QACrEC,qBAAA,GAAwB;MAC1B,OAAO,IAAIE,aAAA,EAAeJ,QAAA,EAAUC,MAAA,KAAW,GAAG;QAChD,MAAMI,kBAAA,GAAqBD,aAAA,EAAeJ,QAAQ,CAAC,EAAE;QACrD,IAAIK,kBAAA,EAAoBF,IAAA,KAAS,QAAQ;UACvC,IAAI,CAAEE,kBAAA,GAAwD,OAAO,EAAEJ,MAAA,EAAQ;YAC7EC,qBAAA,GAAwB;UAC1B;QACF;MACF;IACF;EACF;EAEA,IAAI,CAACJ,WAAA,IAAeI,qBAAA,EAAuB;IACzC,OAAO;EACT,OAAO;IACL,OAAO;EACT;AACF","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/richtext-lexical",
3
- "version": "3.80.0-internal.60d6f94",
3
+ "version": "3.80.0-internal.82dcece",
4
4
  "description": "The officially supported Lexical richtext adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -33,11 +33,6 @@
33
33
  "types": "./dist/exports/client/index.d.ts",
34
34
  "default": "./dist/exports/client/index.js"
35
35
  },
36
- "./internal-client": {
37
- "import": "./dist/exports/client/internal-client.js",
38
- "types": "./dist/exports/client/internal-client.d.ts",
39
- "default": "./dist/exports/client/internal-client.js"
40
- },
41
36
  "./react": {
42
37
  "import": "./dist/exports/react/index.js",
43
38
  "types": "./dist/exports/react/index.d.ts",
@@ -379,8 +374,8 @@
379
374
  "react-error-boundary": "4.1.2",
380
375
  "ts-essentials": "10.0.3",
381
376
  "uuid": "10.0.0",
382
- "@payloadcms/translations": "3.80.0-internal.60d6f94",
383
- "@payloadcms/ui": "3.80.0-internal.60d6f94"
377
+ "@payloadcms/translations": "3.80.0-internal.82dcece",
378
+ "@payloadcms/ui": "3.80.0-internal.82dcece"
384
379
  },
385
380
  "devDependencies": {
386
381
  "@babel/cli": "7.27.2",
@@ -399,7 +394,7 @@
399
394
  "esbuild": "0.27.1",
400
395
  "esbuild-sass-plugin": "3.3.1",
401
396
  "swc-plugin-transform-remove-imports": "8.3.0",
402
- "payload": "3.80.0-internal.60d6f94",
397
+ "payload": "3.80.0-internal.82dcece",
403
398
  "@payloadcms/eslint-config": "3.28.0"
404
399
  },
405
400
  "peerDependencies": {
@@ -407,8 +402,8 @@
407
402
  "@faceless-ui/scroll-info": "2.0.0",
408
403
  "react": "^19.0.1 || ^19.1.2 || ^19.2.1",
409
404
  "react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1",
410
- "@payloadcms/next": "3.80.0-internal.60d6f94",
411
- "payload": "3.80.0-internal.60d6f94"
405
+ "@payloadcms/next": "3.80.0-internal.82dcece",
406
+ "payload": "3.80.0-internal.82dcece"
412
407
  },
413
408
  "engines": {
414
409
  "node": "^18.20.2 || >=20.9.0"