@payloadcms/richtext-lexical 3.61.0-internal.c252d14 → 3.61.0-internal.dd40839

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 (183) hide show
  1. package/dist/cell/rscEntry.d.ts +2 -10
  2. package/dist/cell/rscEntry.d.ts.map +1 -1
  3. package/dist/cell/rscEntry.js +1 -2
  4. package/dist/cell/rscEntry.js.map +1 -1
  5. package/dist/exports/client/Field-5VLZM7KJ.js +2 -0
  6. package/dist/exports/client/Field-5VLZM7KJ.js.map +7 -0
  7. package/dist/exports/client/RelationshipComponent-UCIWIEVD.js +2 -0
  8. package/dist/exports/client/RelationshipComponent-UCIWIEVD.js.map +7 -0
  9. package/dist/exports/client/bundled.css +1 -1
  10. package/dist/exports/client/chunk-52JG5GGJ.js +2 -0
  11. package/dist/exports/client/chunk-52JG5GGJ.js.map +7 -0
  12. package/dist/exports/client/chunk-U4AOQOHA.js +12 -0
  13. package/dist/exports/client/chunk-U4AOQOHA.js.map +7 -0
  14. package/dist/exports/client/component-5YLBQB5B.js +2 -0
  15. package/dist/exports/client/component-5YLBQB5B.js.map +7 -0
  16. package/dist/exports/client/componentInline-QEXUNJU4.js +2 -0
  17. package/dist/exports/client/index.js +22 -22
  18. package/dist/exports/client/index.js.map +3 -3
  19. package/dist/exports/react/index.d.ts +1 -1
  20. package/dist/exports/react/index.d.ts.map +1 -1
  21. package/dist/exports/react/index.js.map +1 -1
  22. package/dist/features/blocks/client/component/BlockContent.js +1 -1
  23. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  24. package/dist/features/blocks/client/component/index.d.ts +1 -0
  25. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  26. package/dist/features/blocks/client/component/index.js +23 -20
  27. package/dist/features/blocks/client/component/index.js.map +1 -1
  28. package/dist/features/blocks/client/componentInline/index.d.ts +2 -1
  29. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  30. package/dist/features/blocks/client/componentInline/index.js +6 -6
  31. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  32. package/dist/features/blocks/client/nodes/BlocksNode.d.ts +2 -2
  33. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  34. package/dist/features/blocks/client/nodes/BlocksNode.js +5 -3
  35. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  36. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts +2 -2
  37. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  38. package/dist/features/blocks/client/nodes/InlineBlocksNode.js +5 -3
  39. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  40. package/dist/features/blocks/server/nodes/BlocksNode.d.ts +2 -1
  41. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  42. package/dist/features/blocks/server/nodes/BlocksNode.js +9 -2
  43. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  44. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +1 -1
  45. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  46. package/dist/features/blocks/server/nodes/InlineBlocksNode.js +6 -5
  47. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  48. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +2 -14
  49. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  50. package/dist/features/converters/lexicalToJSX/Component/index.js +4 -2
  51. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  52. package/dist/features/converters/lexicalToJSX/converter/index.d.ts +16 -1
  53. package/dist/features/converters/lexicalToJSX/converter/index.d.ts.map +1 -1
  54. package/dist/features/converters/lexicalToJSX/converter/index.js +76 -4
  55. package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
  56. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +14 -10
  57. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  58. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  59. package/dist/features/debug/jsxConverter/client/plugin/index.js +1 -1
  60. package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
  61. package/dist/features/link/nodes/AutoLinkNode.js +1 -1
  62. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  63. package/dist/features/link/nodes/LinkNode.js +1 -1
  64. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  65. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  66. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js +4 -4
  67. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  68. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  69. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js +4 -4
  70. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  71. package/dist/features/relationship/client/components/RelationshipComponent.d.ts +1 -1
  72. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  73. package/dist/features/relationship/client/components/RelationshipComponent.js +2 -2
  74. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  75. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts +1 -1
  76. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  77. package/dist/features/relationship/client/nodes/RelationshipNode.js +3 -2
  78. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  79. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +2 -1
  80. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  81. package/dist/features/relationship/server/nodes/RelationshipNode.js +9 -2
  82. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  83. package/dist/features/typesServer.d.ts +2 -2
  84. package/dist/features/typesServer.d.ts.map +1 -1
  85. package/dist/features/typesServer.js.map +1 -1
  86. package/dist/features/upload/client/component/index.d.ts +1 -0
  87. package/dist/features/upload/client/component/index.d.ts.map +1 -1
  88. package/dist/features/upload/client/component/index.js +2 -2
  89. package/dist/features/upload/client/component/index.js.map +1 -1
  90. package/dist/features/upload/client/nodes/UploadNode.d.ts +2 -2
  91. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  92. package/dist/features/upload/client/nodes/UploadNode.js +2 -1
  93. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  94. package/dist/features/upload/client/plugin/index.js +2 -2
  95. package/dist/features/upload/client/plugin/index.js.map +1 -1
  96. package/dist/features/upload/server/nodes/UploadNode.d.ts +2 -1
  97. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  98. package/dist/features/upload/server/nodes/UploadNode.js +6 -0
  99. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  100. package/dist/field/Field.d.ts.map +1 -1
  101. package/dist/field/Field.js +50 -38
  102. package/dist/field/Field.js.map +1 -1
  103. package/dist/field/RichTextViewProvider.d.ts +84 -0
  104. package/dist/field/RichTextViewProvider.d.ts.map +1 -0
  105. package/dist/field/RichTextViewProvider.js +92 -0
  106. package/dist/field/RichTextViewProvider.js.map +1 -0
  107. package/dist/field/ViewSelector.d.ts +4 -0
  108. package/dist/field/ViewSelector.d.ts.map +1 -0
  109. package/dist/field/ViewSelector.js +89 -0
  110. package/dist/field/ViewSelector.js.map +1 -0
  111. package/dist/field/bundled.css +1 -1
  112. package/dist/field/index.d.ts.map +1 -1
  113. package/dist/field/index.js +63 -41
  114. package/dist/field/index.js.map +1 -1
  115. package/dist/field/rscEntry.d.ts +2 -3
  116. package/dist/field/rscEntry.d.ts.map +1 -1
  117. package/dist/field/rscEntry.js +15 -1
  118. package/dist/field/rscEntry.js.map +1 -1
  119. package/dist/index.d.ts +1 -1
  120. package/dist/index.d.ts.map +1 -1
  121. package/dist/index.js +9 -24
  122. package/dist/index.js.map +1 -1
  123. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  124. package/dist/lexical/LexicalEditor.js +2 -1
  125. package/dist/lexical/LexicalEditor.js.map +1 -1
  126. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  127. package/dist/lexical/LexicalProvider.js +12 -3
  128. package/dist/lexical/LexicalProvider.js.map +1 -1
  129. package/dist/lexical/config/client/loader.d.ts.map +1 -1
  130. package/dist/lexical/config/client/loader.js +2 -4
  131. package/dist/lexical/config/client/loader.js.map +1 -1
  132. package/dist/lexical/nodes/index.d.ts +12 -2
  133. package/dist/lexical/nodes/index.d.ts.map +1 -1
  134. package/dist/lexical/nodes/index.js +195 -2
  135. package/dist/lexical/nodes/index.js.map +1 -1
  136. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts +2 -0
  137. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts.map +1 -0
  138. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js +48 -0
  139. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +1 -0
  140. package/dist/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
  141. package/dist/lexical/plugins/handles/utils/setHandlePosition.js +1 -1
  142. package/dist/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
  143. package/dist/lexical/theme/EditorTheme.d.ts.map +1 -1
  144. package/dist/lexical/theme/EditorTheme.js +3 -39
  145. package/dist/lexical/theme/EditorTheme.js.map +1 -1
  146. package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
  147. package/dist/lexical/ui/ContentEditable.js +16 -9
  148. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  149. package/dist/types.d.ts +138 -4
  150. package/dist/types.d.ts.map +1 -1
  151. package/dist/types.js.map +1 -1
  152. package/dist/utilities/editorConfigFactory.js +1 -1
  153. package/dist/utilities/editorConfigFactory.js.map +1 -1
  154. package/dist/utilities/generateImportMap.d.ts +2 -0
  155. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  156. package/dist/utilities/generateImportMap.js +6 -13
  157. package/dist/utilities/generateImportMap.js.map +1 -1
  158. package/dist/{getDefaultSanitizedEditorConfig.d.ts → utilities/getDefaultSanitizedEditorConfig.d.ts} +1 -1
  159. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts.map +1 -0
  160. package/dist/{getDefaultSanitizedEditorConfig.js → utilities/getDefaultSanitizedEditorConfig.js} +2 -2
  161. package/dist/utilities/getDefaultSanitizedEditorConfig.js.map +1 -0
  162. package/dist/utilities/initLexicalFeatures.d.ts.map +1 -1
  163. package/dist/utilities/initLexicalFeatures.js +12 -13
  164. package/dist/utilities/initLexicalFeatures.js.map +1 -1
  165. package/dist/validate/hasText.d.ts +6 -1
  166. package/dist/validate/hasText.d.ts.map +1 -1
  167. package/dist/validate/hasText.js +10 -4
  168. package/dist/validate/hasText.js.map +1 -1
  169. package/package.json +7 -7
  170. package/dist/exports/client/Field-YYMTSGSP.js +0 -2
  171. package/dist/exports/client/Field-YYMTSGSP.js.map +0 -7
  172. package/dist/exports/client/RelationshipComponent-JXQOFHXF.js +0 -2
  173. package/dist/exports/client/RelationshipComponent-JXQOFHXF.js.map +0 -7
  174. package/dist/exports/client/chunk-ADWHGDDR.js +0 -2
  175. package/dist/exports/client/chunk-ADWHGDDR.js.map +0 -7
  176. package/dist/exports/client/chunk-AFXLIYGL.js +0 -12
  177. package/dist/exports/client/chunk-AFXLIYGL.js.map +0 -7
  178. package/dist/exports/client/component-WT25HAJA.js +0 -2
  179. package/dist/exports/client/component-WT25HAJA.js.map +0 -7
  180. package/dist/exports/client/componentInline-MIPTDFRK.js +0 -2
  181. package/dist/getDefaultSanitizedEditorConfig.d.ts.map +0 -1
  182. package/dist/getDefaultSanitizedEditorConfig.js.map +0 -1
  183. /package/dist/exports/client/{componentInline-MIPTDFRK.js.map → componentInline-QEXUNJU4.js.map} +0 -0
package/dist/types.d.ts CHANGED
@@ -1,8 +1,11 @@
1
- import type { EditorConfig as LexicalEditorConfig, SerializedEditorState } from 'lexical';
2
- import type { ClientField, DefaultServerCellComponentProps, LabelFunction, RichTextAdapter, RichTextField, RichTextFieldClient, RichTextFieldClientProps, SanitizedConfig, ServerFieldBase, StaticLabel } from 'payload';
1
+ import type { 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 { JSX } from 'react';
4
+ import type { JSXConverterArgs } from './features/converters/lexicalToJSX/converter/types.js';
3
5
  import type { BaseClientFeatureProps, FeatureProviderProviderClient } from './features/typesClient.js';
4
6
  import type { FeatureProviderServer } from './features/typesServer.js';
5
7
  import type { SanitizedServerEditorConfig } from './lexical/config/types.js';
8
+ import type { DefaultNodeTypes, SerializedBlockNode, SerializedInlineBlockNode } from './nodeTypes.js';
6
9
  import type { InitialLexicalFormState } from './utilities/buildInitialState.js';
7
10
  export type LexicalFieldAdminProps = {
8
11
  /**
@@ -56,10 +59,135 @@ export type FeaturesInput = (({ defaultFeatures, rootFeatures, }: {
56
59
  */
57
60
  rootFeatures: FeatureProviderServer<any, any, any>[];
58
61
  }) => FeatureProviderServer<any, any, any>[]) | FeatureProviderServer<any, any, any>[];
62
+ type WithinEditorArgs = {
63
+ config: EditorConfig;
64
+ editor: LexicalEditor;
65
+ node: LexicalNode;
66
+ };
67
+ export type NodeMapValue<TNode extends {
68
+ [key: string]: any;
69
+ type?: string;
70
+ } = SerializedLexicalNode> = {
71
+ /**
72
+ * Provide a react component to render the node.
73
+ *
74
+ * **JSX Converter:** Always works. Takes priority over `html`.
75
+ *
76
+ * **Lexical Editor:** Only works for DecoratorNodes (renders in `decorate` method). Takes priority over `html` and `createDOM`.
77
+ */
78
+ Component?: (args: ({
79
+ isEditor: false;
80
+ isJSXConverter: true;
81
+ } & JSXConverterArgs<TNode>) | ({
82
+ isEditor: true;
83
+ isJSXConverter: false;
84
+ } & WithinEditorArgs)) => JSX.Element;
85
+ /**
86
+ * Provide a function to create the DOM element for the node.
87
+ *
88
+ * **JSX Converter:** Not used (only `Component` and `html` work).
89
+ *
90
+ * **Lexical Editor:** Always works (renders in `createDOM` method).
91
+ * - For ElementNodes: This is the standard way to customize rendering.
92
+ * - For DecoratorNodes: When combined with `html`, the DOM gets custom structure while `decorate` renders the `html` content.
93
+ */
94
+ createDOM?: (args: WithinEditorArgs) => HTMLElement;
95
+ /**
96
+ * Provide HTML string or function to render the node.
97
+ *
98
+ * **JSX Converter:** Always works (ignored if `Component` is provided).
99
+ *
100
+ * **Lexical Editor behavior depends on node type:**
101
+ *
102
+ * - **ElementNodes:** `html` is used in `createDOM` to generate the DOM structure.
103
+ *
104
+ * - **DecoratorNodes (have both `createDOM` and `decorate`):**
105
+ * - If only `html` is provided: `createDOM` uses `html` to create DOM, `decorate` returns `null`
106
+ * - If `html` + `Component`: `createDOM` uses `html`, `decorate` uses `Component`
107
+ * - If `html` + `createDOM`: Custom `createDOM` creates structure, `decorate` renders `html` content
108
+ * - If `html` + `Component` + `createDOM`: Custom `createDOM` creates structure, `decorate` uses `Component` (html ignored in editor)
109
+ */
110
+ html?: (args: ({
111
+ isEditor: false;
112
+ isJSXConverter: true;
113
+ } & JSXConverterArgs<TNode>) | ({
114
+ isEditor: true;
115
+ isJSXConverter: false;
116
+ } & WithinEditorArgs)) => string;
117
+ };
118
+ /**
119
+ * @experimental - This API is experimental and may change in a minor release.
120
+ * @internal
121
+ */
122
+ export type LexicalEditorNodeMap<TNodes extends {
123
+ [key: string]: any;
124
+ type?: string;
125
+ } = DefaultNodeTypes | SerializedBlockNode<{
126
+ blockName?: null | string;
127
+ blockType: string;
128
+ }> | SerializedInlineBlockNode<{
129
+ blockName?: null | string;
130
+ blockType: string;
131
+ }>> = {
132
+ [key: string]: {
133
+ [blockSlug: string]: NodeMapValue<any>;
134
+ } | NodeMapValue<any> | undefined;
135
+ } & {
136
+ [nodeType in Exclude<NonNullable<TNodes['type']>, 'block' | 'inlineBlock'>]?: NodeMapValue<Extract<TNodes, {
137
+ type: nodeType;
138
+ }>>;
139
+ } & {
140
+ blocks?: {
141
+ [K in Extract<Extract<TNodes, {
142
+ type: 'block';
143
+ }> extends SerializedBlockNode<infer B> ? B extends {
144
+ blockType: string;
145
+ } ? B['blockType'] : never : never, string>]?: NodeMapValue<Extract<TNodes, {
146
+ type: 'block';
147
+ }> extends SerializedBlockNode<infer B> ? SerializedBlockNode<Extract<B, {
148
+ blockType: K;
149
+ }>> : SerializedBlockNode>;
150
+ };
151
+ inlineBlocks?: {
152
+ [K in Extract<Extract<TNodes, {
153
+ type: 'inlineBlock';
154
+ }> extends SerializedInlineBlockNode<infer B> ? B extends {
155
+ blockType: string;
156
+ } ? B['blockType'] : never : never, string>]?: NodeMapValue<Extract<TNodes, {
157
+ type: 'inlineBlock';
158
+ }> extends SerializedInlineBlockNode<infer B> ? SerializedInlineBlockNode<Extract<B, {
159
+ blockType: K;
160
+ }>> : SerializedInlineBlockNode>;
161
+ };
162
+ unknown?: NodeMapValue<SerializedLexicalNode>;
163
+ };
164
+ /**
165
+ * A map of views, which can be used to render the editor in different ways.
166
+ *
167
+ * In order to override the default view, you can add a `default` key to the map.
168
+ *
169
+ * @experimental - This API is experimental and may change in a minor release.
170
+ * @internal
171
+ */
172
+ export type LexicalEditorViewMap = {
173
+ [viewKey: string]: LexicalEditorNodeMap;
174
+ };
175
+ /**
176
+ * @todo rename to LexicalEditorArgs in 4.0, since these are arguments for the lexicalEditor function
177
+ */
59
178
  export type LexicalEditorProps = {
60
179
  admin?: LexicalFieldAdminProps;
61
180
  features?: FeaturesInput;
62
181
  lexical?: LexicalEditorConfig;
182
+ /**
183
+ * A path to a LexicalEditorViewMap, which can be used to render the editor in different ways.
184
+ *
185
+ * In order to override the default view, you can add a `default` key to the map.
186
+ *
187
+ * @experimental - This API is experimental and may change in a minor release.
188
+ * @internal
189
+ */
190
+ views?: PayloadComponent;
63
191
  };
64
192
  export type LexicalRichTextAdapter = {
65
193
  editorConfig: SanitizedServerEditorConfig;
@@ -84,14 +212,19 @@ export type LexicalRichTextFieldProps = {
84
212
  admin?: LexicalFieldAdminClientProps;
85
213
  clientFeatures: {
86
214
  [featureKey: string]: {
87
- clientFeatureProps?: object;
215
+ clientFeatureProps?: BaseClientFeatureProps<Record<string, any>>;
88
216
  clientFeatureProvider?: FeatureProviderProviderClient<any, any>;
89
217
  };
90
218
  };
91
- featureClientImportMap: Record<string, any>;
219
+ /**
220
+ * Part of the import map that contains client components for all lexical features of this field that
221
+ * have been added through `feature.componentImports`.
222
+ */
223
+ featureClientImportMap?: Record<string, any>;
92
224
  featureClientSchemaMap: FeatureClientSchemaMap;
93
225
  initialLexicalFormState: InitialLexicalFormState;
94
226
  lexicalEditorConfig: LexicalEditorConfig | undefined;
227
+ views?: LexicalEditorViewMap;
95
228
  } & Pick<ServerFieldBase, 'permissions'> & RichTextFieldClientProps<SerializedEditorState, AdapterProps, object>;
96
229
  export type LexicalRichTextCellProps = DefaultServerCellComponentProps<RichTextFieldClient<SerializedEditorState, AdapterProps, object>, SerializedEditorState>;
97
230
  export type AdapterProps = {
@@ -102,4 +235,5 @@ export type GeneratedFeatureProviderComponent = {
102
235
  clientFeatureProps: BaseClientFeatureProps<object>;
103
236
  };
104
237
  export type LexicalRichTextField = RichTextField<SerializedEditorState, AdapterProps>;
238
+ export {};
105
239
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,IAAI,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACzF,OAAO,KAAK,EACV,WAAW,EACX,+BAA+B,EAC/B,aAAa,EACb,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,wBAAwB,EACxB,eAAe,EACf,eA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AAC,EAAE,sBAAsB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA;YAChE,qBAAqB,CAAC,EAAE,6BAA6B,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;SAChE,CAAA;KACF,CAAA;IACD;;;OAGG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC5C,sBAAsB,EAAE,sBAAsB,CAAA;IAC9C,uBAAuB,EAAE,uBAAuB,CAAA;IAChD,mBAAmB,EAAE,mBAAmB,GAAG,SAAS,CAAA;IACpD,KAAK,CAAC,EAAE,oBAAoB,CAAA;CAC7B,GAAG,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,GACtC,wBAAwB,CAAC,qBAAqB,EAAE,YAAY,EAAE,MAAM,CAAC,CAAA;AAEvE,MAAM,MAAM,wBAAwB,GAAG,+BAA+B,CACpE,mBAAmB,CAAC,qBAAqB,EAAE,YAAY,EAAE,MAAM,CAAC,EAChE,qBAAqB,CACtB,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,YAAY,EAAE,2BAA2B,CAAA;CAC1C,CAAA;AAED,MAAM,MAAM,iCAAiC,GAAG;IAC9C,aAAa,EAAE,6BAA6B,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACtD,kBAAkB,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAA;CACnD,CAAA;AAED,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 { 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?: object\n clientFeatureProvider?: FeatureProviderProviderClient<any, any>\n }\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":"AAgJA","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type {\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'\nimport type { JSX } from 'react'\n\nimport type { JSXConverterArgs } 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\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\nexport type NodeMapValue<\n TNode extends { [key: string]: any; type?: string } = SerializedLexicalNode,\n> = {\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 } & WithinEditorArgs),\n ) => JSX.Element\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\n/**\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\nexport type LexicalEditorNodeMap<\n TNodes extends { [key: string]: any; type?: string } =\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 [key: string]:\n | {\n [blockSlug: string]: NodeMapValue<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 >]?: NodeMapValue<\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 >]?: NodeMapValue<\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 [viewKey: string]: LexicalEditorNodeMap\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":"AAiTA","ignoreList":[]}
@@ -1,7 +1,7 @@
1
- import { getDefaultSanitizedEditorConfig } from '../getDefaultSanitizedEditorConfig.js';
2
1
  import { defaultEditorConfig, defaultEditorFeatures } from '../lexical/config/server/default.js';
3
2
  import { loadFeatures } from '../lexical/config/server/loader.js';
4
3
  import { sanitizeServerFeatures } from '../lexical/config/server/sanitize.js';
4
+ import { getDefaultSanitizedEditorConfig } from './getDefaultSanitizedEditorConfig.js';
5
5
  export const editorConfigFactory = {
6
6
  default: async args => {
7
7
  return getDefaultSanitizedEditorConfig({
@@ -1 +1 @@
1
- {"version":3,"file":"editorConfigFactory.js","names":["getDefaultSanitizedEditorConfig","defaultEditorConfig","defaultEditorFeatures","loadFeatures","sanitizeServerFeatures","editorConfigFactory","default","args","config","parentIsLocalized","fromEditor","lexicalAdapter","editor","isRoot","sanitizedServerEditorConfig","editorConfig","fromFeatures","featuresInputToEditorConfig","sanitizedConfig","fromField","field","fromUnsanitizedField","lexicalAdapterProvider","features","rootEditor","rootEditorFeatures","defaultFeatures","rootFeatures","lexical","resolvedFeatureMap","unSanitizedEditorConfig"],"sources":["../../src/utilities/editorConfigFactory.ts"],"sourcesContent":["import type { EditorConfig as LexicalEditorConfig } from 'lexical'\nimport type { RichTextAdapterProvider, RichTextField, SanitizedConfig } from 'payload'\n\nimport type { FeatureProviderServer, ResolvedServerFeatureMap } from '../features/typesServer.js'\nimport type { SanitizedServerEditorConfig } from '../lexical/config/types.js'\nimport type {\n FeaturesInput,\n LexicalRichTextAdapter,\n LexicalRichTextAdapterProvider,\n} from '../types.js'\n\nimport { getDefaultSanitizedEditorConfig } from '../getDefaultSanitizedEditorConfig.js'\nimport { defaultEditorConfig, defaultEditorFeatures } from '../lexical/config/server/default.js'\nimport { loadFeatures } from '../lexical/config/server/loader.js'\nimport { sanitizeServerFeatures } from '../lexical/config/server/sanitize.js'\n\nexport const editorConfigFactory = {\n default: async (args: {\n config: SanitizedConfig\n parentIsLocalized?: boolean\n }): Promise<SanitizedServerEditorConfig> => {\n return getDefaultSanitizedEditorConfig({\n config: args.config,\n parentIsLocalized: args.parentIsLocalized ?? false,\n })\n },\n /**\n * If you have instantiated a lexical editor and are accessing it outside a field (=> this is the unsanitized editor),\n * you can extract the editor config from it.\n * This is common if you define the editor in a re-usable module scope variable and pass it to the richText field.\n *\n * This is the least efficient way to get the editor config, and not recommended. It is recommended to extract the `features` arg\n * into a separate variable and use `fromFeatures` instead.\n */\n fromEditor: async (args: {\n config: SanitizedConfig\n editor: LexicalRichTextAdapterProvider\n isRoot?: boolean\n lexical?: LexicalEditorConfig\n parentIsLocalized?: boolean\n }): Promise<SanitizedServerEditorConfig> => {\n const lexicalAdapter: LexicalRichTextAdapter = await args.editor({\n config: args.config,\n isRoot: args.isRoot ?? false,\n parentIsLocalized: args.parentIsLocalized ?? false,\n })\n\n const sanitizedServerEditorConfig: SanitizedServerEditorConfig = lexicalAdapter.editorConfig\n return sanitizedServerEditorConfig\n },\n /**\n * Create a new editor config - behaves just like instantiating a new `lexicalEditor`\n */\n fromFeatures: async (args: {\n config: SanitizedConfig\n features?: FeaturesInput\n isRoot?: boolean\n lexical?: LexicalEditorConfig\n parentIsLocalized?: boolean\n }): Promise<SanitizedServerEditorConfig> => {\n return (await featuresInputToEditorConfig(args)).sanitizedConfig\n },\n fromField: (args: { field: RichTextField }): SanitizedServerEditorConfig => {\n const lexicalAdapter: LexicalRichTextAdapter = args.field.editor as LexicalRichTextAdapter\n\n const sanitizedServerEditorConfig: SanitizedServerEditorConfig = lexicalAdapter.editorConfig\n return sanitizedServerEditorConfig\n },\n fromUnsanitizedField: async (args: {\n config: SanitizedConfig\n field: RichTextField\n isRoot?: boolean\n parentIsLocalized?: boolean\n }): Promise<SanitizedServerEditorConfig> => {\n const lexicalAdapterProvider: RichTextAdapterProvider = args.field\n .editor as RichTextAdapterProvider\n\n const lexicalAdapter: LexicalRichTextAdapter = (await lexicalAdapterProvider({\n config: args.config,\n isRoot: args.isRoot ?? false,\n parentIsLocalized: args.parentIsLocalized ?? false,\n })) as LexicalRichTextAdapter\n\n const sanitizedServerEditorConfig: SanitizedServerEditorConfig = lexicalAdapter.editorConfig\n return sanitizedServerEditorConfig\n },\n}\n\nexport const featuresInputToEditorConfig = async (args: {\n config: SanitizedConfig\n features?: FeaturesInput\n isRoot?: boolean\n lexical?: LexicalEditorConfig\n parentIsLocalized?: boolean\n}): Promise<{\n features: FeatureProviderServer<unknown, unknown, unknown>[]\n resolvedFeatureMap: ResolvedServerFeatureMap\n sanitizedConfig: SanitizedServerEditorConfig\n}> => {\n let features: FeatureProviderServer<unknown, unknown, unknown>[] = []\n if (args.features && typeof args.features === 'function') {\n const rootEditor = args.config.editor\n let rootEditorFeatures: FeatureProviderServer<unknown, unknown, unknown>[] = []\n if (typeof rootEditor === 'object' && 'features' in rootEditor) {\n rootEditorFeatures = (rootEditor as LexicalRichTextAdapter).features\n }\n features = args.features({\n defaultFeatures: defaultEditorFeatures,\n rootFeatures: rootEditorFeatures,\n })\n } else {\n features = args.features as FeatureProviderServer<unknown, unknown, unknown>[]\n }\n\n if (!features) {\n features = defaultEditorFeatures\n }\n\n const lexical = args.lexical ?? defaultEditorConfig.lexical\n\n const resolvedFeatureMap = await loadFeatures({\n config: args.config,\n isRoot: args.isRoot ?? false,\n parentIsLocalized: args.parentIsLocalized ?? false,\n unSanitizedEditorConfig: {\n features,\n lexical,\n },\n })\n\n return {\n features,\n resolvedFeatureMap,\n sanitizedConfig: {\n features: sanitizeServerFeatures(resolvedFeatureMap),\n lexical: args.lexical,\n resolvedFeatureMap,\n },\n }\n}\n"],"mappings":"AAWA,SAASA,+BAA+B,QAAQ;AAChD,SAASC,mBAAmB,EAAEC,qBAAqB,QAAQ;AAC3D,SAASC,YAAY,QAAQ;AAC7B,SAASC,sBAAsB,QAAQ;AAEvC,OAAO,MAAMC,mBAAA,GAAsB;EACjCC,OAAA,EAAS,MAAOC,IAAA;IAId,OAAOP,+BAAA,CAAgC;MACrCQ,MAAA,EAAQD,IAAA,CAAKC,MAAM;MACnBC,iBAAA,EAA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I,MAAM;IACrC,IAAIa,kBAAA,GAAyE,EAAE;IAC/E,IAAI,OAAOD,UAAA,KAAe,YAAY,cAAcA,UAAA,EAAY;MAC9DC,kBAAA,GAAqBD,UAAC,CAAsCD,QAAQ;IACtE;IACAA,QAAA,GAAWhB,IAAA,CAAKgB,QAAQ,CAAC;MACvBG,eAAA,EAAiBxB,qBAAA;MACjByB,YAAA,EAAcF;IAChB;EACF,OAAO;IACLF,QAAA,GAAWhB,IAAA,CAAKgB,QAAQ;EAC1B;EAEA,IAAI,CAACA,QAAA,EAAU;IACbA,QAAA,GAAWrB,qBAAA;EACb;EAEA,MAAM0B,OAAA,GAAUrB,IAAA,CAAKqB,OAAO,IAAI3B,mBAAA,CAAoB2B,OAAO;EAE3D,MAAMC,kBAAA,GAAqB,MAAM1B,YAAA,CAAa;IAC5CK,MAAA,EAAQD,IAAA,CAAKC,MAAM;IACnBK,MAAA,EAAQN,IAAA,CAAKM,MAAM,IAAI;IACvBJ,iBAAA,EAAmBF,IAAA,CAAKE,iBAAiB,IAAI;IAC7CqB,uBAAA,EAAyB;MACvBP,QAAA;MACAK;IACF;EACF;EAEA,OAAO;IACLL,QAAA;IACAM,kBAAA;IACAX,eAAA,EAAiB;MACfK,QAAA,EAAUnB,sBAAA,CAAuByB,kBAAA;MACjCD,OAAA,EAASrB,IAAA,CAAKqB,OAAO;MACrBC;IACF;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"editorConfigFactory.js","names":["defaultEditorConfig","defaultEditorFeatures","loadFeatures","sanitizeServerFeatures","getDefaultSanitizedEditorConfig","editorConfigFactory","default","args","config","parentIsLocalized","fromEditor","lexicalAdapter","editor","isRoot","sanitizedServerEditorConfig","editorConfig","fromFeatures","featuresInputToEditorConfig","sanitizedConfig","fromField","field","fromUnsanitizedField","lexicalAdapterProvider","features","rootEditor","rootEditorFeatures","defaultFeatures","rootFeatures","lexical","resolvedFeatureMap","unSanitizedEditorConfig"],"sources":["../../src/utilities/editorConfigFactory.ts"],"sourcesContent":["import type { EditorConfig as LexicalEditorConfig } from 'lexical'\nimport type { RichTextAdapterProvider, RichTextField, SanitizedConfig } from 'payload'\n\nimport type { FeatureProviderServer, ResolvedServerFeatureMap } from '../features/typesServer.js'\nimport type { SanitizedServerEditorConfig } from '../lexical/config/types.js'\nimport type {\n FeaturesInput,\n LexicalRichTextAdapter,\n LexicalRichTextAdapterProvider,\n} from '../types.js'\n\nimport { defaultEditorConfig, defaultEditorFeatures } from '../lexical/config/server/default.js'\nimport { loadFeatures } from '../lexical/config/server/loader.js'\nimport { sanitizeServerFeatures } from '../lexical/config/server/sanitize.js'\nimport { getDefaultSanitizedEditorConfig } from './getDefaultSanitizedEditorConfig.js'\n\nexport const editorConfigFactory = {\n default: async (args: {\n config: SanitizedConfig\n parentIsLocalized?: boolean\n }): Promise<SanitizedServerEditorConfig> => {\n return getDefaultSanitizedEditorConfig({\n config: args.config,\n parentIsLocalized: args.parentIsLocalized ?? false,\n })\n },\n /**\n * If you have instantiated a lexical editor and are accessing it outside a field (=> this is the unsanitized editor),\n * you can extract the editor config from it.\n * This is common if you define the editor in a re-usable module scope variable and pass it to the richText field.\n *\n * This is the least efficient way to get the editor config, and not recommended. It is recommended to extract the `features` arg\n * into a separate variable and use `fromFeatures` instead.\n */\n fromEditor: async (args: {\n config: SanitizedConfig\n editor: LexicalRichTextAdapterProvider\n isRoot?: boolean\n lexical?: LexicalEditorConfig\n parentIsLocalized?: boolean\n }): Promise<SanitizedServerEditorConfig> => {\n const lexicalAdapter: LexicalRichTextAdapter = await args.editor({\n config: args.config,\n isRoot: args.isRoot ?? false,\n parentIsLocalized: args.parentIsLocalized ?? false,\n })\n\n const sanitizedServerEditorConfig: SanitizedServerEditorConfig = lexicalAdapter.editorConfig\n return sanitizedServerEditorConfig\n },\n /**\n * Create a new editor config - behaves just like instantiating a new `lexicalEditor`\n */\n fromFeatures: async (args: {\n config: SanitizedConfig\n features?: FeaturesInput\n isRoot?: boolean\n lexical?: LexicalEditorConfig\n parentIsLocalized?: boolean\n }): Promise<SanitizedServerEditorConfig> => {\n return (await featuresInputToEditorConfig(args)).sanitizedConfig\n },\n fromField: (args: { field: RichTextField }): SanitizedServerEditorConfig => {\n const lexicalAdapter: LexicalRichTextAdapter = args.field.editor as LexicalRichTextAdapter\n\n const sanitizedServerEditorConfig: SanitizedServerEditorConfig = lexicalAdapter.editorConfig\n return sanitizedServerEditorConfig\n },\n fromUnsanitizedField: async (args: {\n config: SanitizedConfig\n field: RichTextField\n isRoot?: boolean\n parentIsLocalized?: boolean\n }): Promise<SanitizedServerEditorConfig> => {\n const lexicalAdapterProvider: RichTextAdapterProvider = args.field\n .editor as RichTextAdapterProvider\n\n const lexicalAdapter: LexicalRichTextAdapter = (await lexicalAdapterProvider({\n config: args.config,\n isRoot: args.isRoot ?? false,\n parentIsLocalized: args.parentIsLocalized ?? false,\n })) as LexicalRichTextAdapter\n\n const sanitizedServerEditorConfig: SanitizedServerEditorConfig = lexicalAdapter.editorConfig\n return sanitizedServerEditorConfig\n },\n}\n\nexport const featuresInputToEditorConfig = async (args: {\n config: SanitizedConfig\n features?: FeaturesInput\n isRoot?: boolean\n lexical?: LexicalEditorConfig\n parentIsLocalized?: boolean\n}): Promise<{\n features: FeatureProviderServer<unknown, unknown, unknown>[]\n resolvedFeatureMap: ResolvedServerFeatureMap\n sanitizedConfig: SanitizedServerEditorConfig\n}> => {\n let features: FeatureProviderServer<unknown, unknown, unknown>[] = []\n if (args.features && typeof args.features === 'function') {\n const rootEditor = args.config.editor\n let rootEditorFeatures: FeatureProviderServer<unknown, unknown, unknown>[] = []\n if (typeof rootEditor === 'object' && 'features' in rootEditor) {\n rootEditorFeatures = (rootEditor as LexicalRichTextAdapter).features\n }\n features = args.features({\n defaultFeatures: defaultEditorFeatures,\n rootFeatures: rootEditorFeatures,\n })\n } else {\n features = args.features as FeatureProviderServer<unknown, unknown, unknown>[]\n }\n\n if (!features) {\n features = defaultEditorFeatures\n }\n\n const lexical = args.lexical ?? defaultEditorConfig.lexical\n\n const resolvedFeatureMap = await loadFeatures({\n config: args.config,\n isRoot: args.isRoot ?? false,\n parentIsLocalized: args.parentIsLocalized ?? false,\n unSanitizedEditorConfig: {\n features,\n lexical,\n },\n })\n\n return {\n features,\n resolvedFeatureMap,\n sanitizedConfig: {\n features: sanitizeServerFeatures(resolvedFeatureMap),\n lexical: args.lexical,\n resolvedFeatureMap,\n },\n }\n}\n"],"mappings":"AAWA,SAASA,mBAAmB,EAAEC,qBAAqB,QAAQ;AAC3D,SAASC,YAAY,QAAQ;AAC7B,SAASC,sBAAsB,QAAQ;AACvC,SAASC,+BAA+B,QAAQ;AAEhD,OAAO,MAAMC,mBAAA,GAAsB;EACjCC,OAAA,EAAS,MAAOC,IAAA;IAId,OAAOH,+BAAA,CAAgC;MACrCI,MAAA,EAAQD,IAAA,CAAKC,MAAM;MACnBC,iBAAA,EAAmBF,IAAA,CAAKE,iBAAiB,IAAI;IAC/C;EACF;EACA;;;;;;;;EAQAC,UAAA,EAAY,MAAOH,IAAA;IAOjB,MAAMI,cAAA,GAAyC,MAAMJ,IAAA,CAAKK,MAAM,CAAC;MAC/DJ,MAAA,EAAQD,IAAA,CAAKC,MAAM;MACnBK,MAAA,EAAQN,IAAA,CAAKM,MAAM,IAAI;MACvBJ,iBAAA,EAAmBF,IAAA,CAAKE,iBAAiB,IAAI;IAC/C;IAEA,MAAMK,2BAAA,GAA2DH,cAAA,CAAeI,YAAY;IAC5F,OAAOD,2BAAA;EACT;EACA;;;EAGAE,YAAA,EAAc,MAAOT,IAAA;IAOnB,OAAO,CAAC,MAAMU,2BAAA,CAA4BV,IAAA,CAAI,EAAGW,eAAe;EAClE;EACAC,SAAA,EAAYZ,IAAA;IACV,MAAMI,cAAA,GAAyCJ,IAAA,CAAKa,KAAK,CAACR,MAAM;IAEhE,MAAME,2BAAA,GAA2DH,cAAA,CAAeI,YAAY;IAC5F,OAAOD,2BAAA;EACT;EACAO,oBAAA,EAAsB,MAAOd,IAAA;IAM3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;MACAK;IACF;EACF;EAEA,OAAO;IACLL,QAAA;IACAM,kBAAA;IACAX,eAAA,EAAiB;MACfK,QAAA,EAAUpB,sBAAA,CAAuB0B,kBAAA;MACjCD,OAAA,EAASrB,IAAA,CAAKqB,OAAO;MACrBC;IACF;EACF;AACF","ignoreList":[]}
@@ -1,6 +1,8 @@
1
1
  import type { RichTextAdapter } from 'payload';
2
2
  import type { ResolvedServerFeatureMap } from '../features/typesServer.js';
3
+ import type { LexicalEditorProps } from '../types.js';
3
4
  export declare const getGenerateImportMap: (args: {
5
+ lexicalEditorArgs?: LexicalEditorProps;
4
6
  resolvedFeatureMap: ResolvedServerFeatureMap;
5
7
  }) => RichTextAdapter["generateImportMap"];
6
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,EAAoB,eAAe,EAAE,MAAM,SAAS,CAAA;AAIhE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAE1E,eAAO,MAAM,oBAAoB,SACxB;IAAE,kBAAkB,EAAE,wBAAwB,CAAA;CAAE,KAAG,eAAe,CAAC,mBAAmB,CA0D5F,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,CAiDtC,CAAA"}
@@ -9,7 +9,7 @@ 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
- // iterate just through args.resolvedFeatureMap.values()
12
+ addToImportMap(args.lexicalEditorArgs?.views);
13
13
  for (const resolvedFeature of args.resolvedFeatureMap.values()) {
14
14
  if ('componentImports' in resolvedFeature) {
15
15
  if (typeof resolvedFeature.componentImports === 'function') {
@@ -20,22 +20,15 @@ export const getGenerateImportMap = args => ({
20
20
  importMap,
21
21
  imports
22
22
  });
23
- } else if (Array.isArray(resolvedFeature.componentImports) && resolvedFeature.componentImports?.length) {
24
- resolvedFeature.componentImports.forEach(component => {
25
- addToImportMap(component);
26
- });
23
+ } else if (Array.isArray(resolvedFeature.componentImports)) {
24
+ addToImportMap(resolvedFeature.componentImports);
27
25
  } else if (typeof resolvedFeature.componentImports === 'object') {
28
- for (const component of Object.values(resolvedFeature.componentImports)) {
29
- addToImportMap(component);
30
- }
26
+ addToImportMap(Object.values(resolvedFeature.componentImports));
31
27
  }
32
28
  }
33
- const ClientComponent = resolvedFeature.ClientFeature;
34
- if (ClientComponent) {
35
- addToImportMap(ClientComponent);
36
- }
29
+ addToImportMap(resolvedFeature.ClientFeature);
37
30
  /*
38
- Now run for all possible sub-fields
31
+ * Now run for all possible sub-fields
39
32
  */
40
33
  if (resolvedFeature.nodes?.length) {
41
34
  for (const node of resolvedFeature.nodes) {
@@ -1 +1 @@
1
- {"version":3,"file":"generateImportMap.js","names":["genImportMapIterateFields","getGenerateImportMap","args","addToImportMap","baseDir","config","importMap","imports","resolvedFeature","resolvedFeatureMap","values","componentImports","Array","isArray","length","forEach","component","Object","ClientComponent","ClientFeature","nodes","node","getSubFields","subFields","fields"],"sources":["../../src/utilities/generateImportMap.tsx"],"sourcesContent":["import type { PayloadComponent, RichTextAdapter } from 'payload'\n\nimport { genImportMapIterateFields } from 'payload'\n\nimport type { ResolvedServerFeatureMap } from '../features/typesServer.js'\n\nexport const getGenerateImportMap =\n (args: { resolvedFeatureMap: ResolvedServerFeatureMap }): 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 // iterate just through args.resolvedFeatureMap.values()\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 (\n Array.isArray(resolvedFeature.componentImports) &&\n resolvedFeature.componentImports?.length\n ) {\n resolvedFeature.componentImports.forEach((component) => {\n addToImportMap(component)\n })\n } else if (typeof resolvedFeature.componentImports === 'object') {\n for (const component of Object.values(resolvedFeature.componentImports)) {\n addToImportMap(component as PayloadComponent)\n }\n }\n }\n\n const ClientComponent = resolvedFeature.ClientFeature\n if (ClientComponent) {\n addToImportMap(ClientComponent)\n }\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;AAI1C,OAAO,MAAMC,oBAAA,GACVC,IAAA,IACD,CAAC;EAAEC,cAAc;EAAEC,OAAO;EAAEC,MAAM;EAAEC,SAAS;EAAEC;AAAO,CAAE;EACtDJ,cAAA,CAAe;EACfA,cAAA,CAAe;EACfA,cAAA,CAAe;EAEf;EACA,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,IACLK,KAAA,CAAMC,OAAO,CAACL,eAAA,CAAgBG,gBAAgB,KAC9CH,eAAA,CAAgBG,gBAAgB,EAAEG,MAAA,EAClC;QACAN,eAAA,CAAgBG,gBAAgB,CAACI,OAAO,CAAEC,SAAA;UACxCb,cAAA,CAAea,SAAA;QACjB;MACF,OAAO,IAAI,OAAOR,eAAA,CAAgBG,gBAAgB,KAAK,UAAU;QAC/D,KAAK,MAAMK,SAAA,IAAaC,MAAA,CAAOP,MAAM,CAACF,eAAA,CAAgBG,gBAAgB,GAAG;UACvER,cAAA,CAAea,SAAA;QACjB;MACF;IACF;IAEA,MAAME,eAAA,GAAkBV,eAAA,CAAgBW,aAAa;IACrD,IAAID,eAAA,EAAiB;MACnBf,cAAA,CAAee,eAAA;IACjB;IAEA;;;IAGA,IAAIV,eAAA,CAAgBY,KAAK,EAAEN,MAAA,EAAQ;MACjC,KAAK,MAAMO,IAAA,IAAQb,eAAA,CAAgBY,KAAK,EAAE;QACxC,IAAI,OAAOC,IAAA,EAAMC,YAAA,KAAiB,YAAY;UAC5C;QACF;QACA,MAAMC,SAAA,GAAYF,IAAA,CAAKC,YAAY,CAAC,CAAC;QACrC,IAAIC,SAAA,EAAWT,MAAA,EAAQ;UACrBd,yBAAA,CAA0B;YACxBG,cAAA;YACAC,OAAA;YACAC,MAAA;YACAmB,MAAA,EAAQD,SAAA;YACRjB,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 { 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,G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itizedConfig } from 'payload';
2
- import { type SanitizedServerEditorConfig } from './index.js';
2
+ import { type SanitizedServerEditorConfig } from '../index.js';
3
3
  export declare const getDefaultSanitizedEditorConfig: (args: {
4
4
  config: SanitizedConfig;
5
5
  parentIsLocalized: boolean;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDefaultSanitizedEditorConfig.d.ts","sourceRoot":"","sources":["../../src/utilities/getDefaultSanitizedEditorConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,aAAa,CAAA;AAgB9D,eAAO,MAAM,+BAA+B,SAAgB;IAC1D,MAAM,EAAE,eAAe,CAAA;IACvB,iBAAiB,EAAE,OAAO,CAAA;CAC3B,KAAG,OAAO,CAAC,2BAA2B,CAoBtC,CAAA"}
@@ -1,5 +1,5 @@
1
- import { defaultEditorConfig } from './lexical/config/server/default.js';
2
- import { sanitizeServerEditorConfig } from './lexical/config/server/sanitize.js';
1
+ import { defaultEditorConfig } from '../lexical/config/server/default.js';
2
+ import { sanitizeServerEditorConfig } from '../lexical/config/server/sanitize.js';
3
3
  let cachedDefaultSanitizedServerEditorConfig = global._payload_lexical_defaultSanitizedServerEditorConfig;
4
4
  if (!cachedDefaultSanitizedServerEditorConfig) {
5
5
  cachedDefaultSanitizedServerEditorConfig = global._payload_lexical_defaultSanitizedServerEditorConfig = null;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDefaultSanitizedEditorConfig.js","names":["defaultEditorConfig","sanitizeServerEditorConfig","cachedDefaultSanitizedServerEditorConfig","global","_payload_lexical_defaultSanitizedServerEditorConfig","getDefaultSanitizedEditorConfig","args","config","parentIsLocalized","payload_lexical_defaultSanitizedServerEditorConfig"],"sources":["../../src/utilities/getDefaultSanitizedEditorConfig.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport { type SanitizedServerEditorConfig } from '../index.js'\nimport { defaultEditorConfig } from '../lexical/config/server/default.js'\nimport { sanitizeServerEditorConfig } from '../lexical/config/server/sanitize.js'\n\nlet cachedDefaultSanitizedServerEditorConfig:\n | null\n | Promise<SanitizedServerEditorConfig>\n | SanitizedServerEditorConfig = (global as any)\n ._payload_lexical_defaultSanitizedServerEditorConfig\n\nif (!cachedDefaultSanitizedServerEditorConfig) {\n cachedDefaultSanitizedServerEditorConfig = (\n global as any\n )._payload_lexical_defaultSanitizedServerEditorConfig = null\n}\n\nexport const getDefaultSanitizedEditorConfig = async (args: {\n config: SanitizedConfig\n parentIsLocalized: boolean\n}): Promise<SanitizedServerEditorConfig> => {\n const { config, parentIsLocalized } = args\n\n if (cachedDefaultSanitizedServerEditorConfig) {\n return await cachedDefaultSanitizedServerEditorConfig\n }\n\n cachedDefaultSanitizedServerEditorConfig = sanitizeServerEditorConfig(\n defaultEditorConfig,\n config,\n parentIsLocalized,\n )\n ;(global as any).payload_lexical_defaultSanitizedServerEditorConfig =\n cachedDefaultSanitizedServerEditorConfig\n\n cachedDefaultSanitizedServerEditorConfig = await cachedDefaultSanitizedServerEditorConfig\n ;(global as any).payload_lexical_defaultSanitizedServerEditorConfig =\n cachedDefaultSanitizedServerEditorConfig\n\n return cachedDefaultSanitizedServerEditorConfig\n}\n"],"mappings":"AAGA,SAASA,mBAAmB,QAAQ;AACpC,SAASC,0BAA0B,QAAQ;AAE3C,IAAIC,wCAAA,GAG8BC,MAAC,CAChCC,mDAAmD;AAEtD,IAAI,CAACF,wCAAA,EAA0C;EAC7CA,wCAAA,GAA2CC,MACzC,CACAC,mDAAmD,GAAG;AAC1D;AAEA,OAAO,MAAMC,+BAAA,GAAkC,MAAOC,IAAA;EAIpD,MAAM;IAAEC,MAAM;IAAEC;EAAiB,CAAE,GAAGF,IAAA;EAEtC,IAAIJ,wCAAA,EAA0C;IAC5C,OAAO,MAAMA,wCAAA;EACf;EAEAA,wCAAA,GAA2CD,0BAAA,CACzCD,mBAAA,EACAO,MAAA,EACAC,iBAAA;EAEAL,MAAA,CAAeM,kDAAkD,GACjEP,wCAAA;EAEFA,wCAAA,GAA2C,MAAMA,wCAAA;EAC/CC,MAAA,CAAeM,kDAAkD,GACjEP,wCAAA;EAEF,OAAOA,wCAAA;AACT","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"initLexicalFeatures.d.ts","sourceRoot":"","sources":["../../src/utilities/initLexicalFeatures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,OAAO,EAAE,KAAK,oBAAoB,EAAE,KAAK,cAAc,EAAE,KAAK,OAAO,EAAE,MAAM,SAAS,CAAA;AAItF,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAC7E,OAAO,KAAK,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AACpF,KAAK,IAAI,GAAG;IACV,oBAAoB,EAAE,oBAAoB,CAAA;IAC1C,cAAc,EAAE,cAAc,CAAA;IAC9B,IAAI,EAAE,UAAU,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;IAChB,qBAAqB,EAAE,2BAA2B,CAAA;IAClD,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG;IAC/C,cAAc,EAAE,yBAAyB,CAAC,gBAAgB,CAAC,CAAA;IAC3D,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3C,sBAAsB,EAAE,sBAAsB,CAAA;CAC/C,CA8FA"}
1
+ {"version":3,"file":"initLexicalFeatures.d.ts","sourceRoot":"","sources":["../../src/utilities/initLexicalFeatures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,OAAO,EAAE,KAAK,oBAAoB,EAAE,KAAK,cAAc,EAAE,KAAK,OAAO,EAAE,MAAM,SAAS,CAAA;AAOtF,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAC7E,OAAO,KAAK,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AACpF,KAAK,IAAI,GAAG;IACV,oBAAoB,EAAE,oBAAoB,CAAA;IAC1C,cAAc,EAAE,cAAc,CAAA;IAC9B,IAAI,EAAE,UAAU,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;IAChB,qBAAqB,EAAE,2BAA2B,CAAA;IAClD,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG;IAC/C,cAAc,EAAE,yBAAyB,CAAC,gBAAgB,CAAC,CAAA;IAC3D,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3C,sBAAsB,EAAE,sBAAsB,CAAA;CAC/C,CA0FA"}
@@ -2,7 +2,7 @@ import { getFromImportMap } from 'payload/shared';
2
2
  export function initLexicalFeatures(args) {
3
3
  const clientFeatures = {};
4
4
  // turn args.resolvedFeatureMap into an array of [key, value] pairs, ordered by value.order, lowest order first:
5
- const resolvedFeatureMapArray = Array.from(args.sanitizedEditorConfig.resolvedFeatureMap.entries()).sort((a, b) => a[1].order - b[1].order);
5
+ const resolvedFeatureMapArray = [...args.sanitizedEditorConfig.resolvedFeatureMap].sort((a, b) => a[1].order - b[1].order);
6
6
  const featureClientSchemaMap = {};
7
7
  /**
8
8
  * All modules added to the import map, keyed by the provided key, if feature.componentImports with type object is used
@@ -42,7 +42,7 @@ export function initLexicalFeatures(args) {
42
42
  // as well, as it already called feature.generateSchemaMap for each feature.
43
43
  // We will check for the existance resolvedFeature.generateSchemaMap to skip unnecessary loops for constructing featureSchemaMap, but we don't run it here
44
44
  if (resolvedFeature.generateSchemaMap) {
45
- const featureSchemaPath = [...args.schemaPath.split('.'), 'lexical_internal_feature', featureKey].join('.');
45
+ const featureSchemaPath = `${args.schemaPath}.lexical_internal_feature.${featureKey}`;
46
46
  featureClientSchemaMap[featureKey] = {};
47
47
  // Like args.fieldSchemaMap, we only want to include the sub-fields of the current feature
48
48
  for (const [key, entry] of args.clientFieldSchemaMap.entries()) {
@@ -50,17 +50,16 @@ export function initLexicalFeatures(args) {
50
50
  featureClientSchemaMap[featureKey][key] = 'fields' in entry ? entry.fields : [entry];
51
51
  }
52
52
  }
53
- if (resolvedFeature.componentImports && typeof resolvedFeature.componentImports === 'object') {
54
- for (const key in resolvedFeature.componentImports) {
55
- const payloadComponent = resolvedFeature.componentImports[key];
56
- const resolvedComponent = getFromImportMap({
57
- importMap: args.payload.importMap,
58
- PayloadComponent: payloadComponent,
59
- schemaPath: 'lexical-clientComponent',
60
- silent: true
61
- });
62
- featureClientImportMap[`${resolvedFeature.key}.${key}`] = resolvedComponent;
63
- }
53
+ }
54
+ if (resolvedFeature.componentImports && typeof resolvedFeature.componentImports === 'object' && !Array.isArray(resolvedFeature.componentImports)) {
55
+ for (const [key, payloadComponent] of Object.entries(resolvedFeature.componentImports)) {
56
+ const resolvedComponent = getFromImportMap({
57
+ importMap: args.payload.importMap,
58
+ PayloadComponent: payloadComponent,
59
+ schemaPath: 'lexical-clientComponent',
60
+ silent: true
61
+ });
62
+ featureClientImportMap[`${resolvedFeature.key}.${key}`] = resolvedComponent;
64
63
  }
65
64
  }
66
65
  }
@@ -1 +1 @@
1
- {"version":3,"file":"initLexicalFeatures.js","names":["getFromImportMap","initLexicalFeatures","args","clientFeatures","resolvedFeatureMapArray","Array","from","sanitizedEditorConfig","resolvedFeatureMap","entries","sort","a","b","order","featureClientSchemaMap","featureClientImportMap","featureKey","resolvedFeature","ClientFeaturePayloadComponent","ClientFeature","clientFeatureProvider","importMap","payload","PayloadComponent","schemaPath","silent","clientFeatureProps","key","clientProps","generateSchemaMap","featureSchemaPath","split","join","entry","clientFieldSchemaMap","startsWith","fields","componentImports","payloadComponent","resolvedComponent"],"sources":["../../src/utilities/initLexicalFeatures.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\n\nimport { type ClientFieldSchemaMap, type FieldSchemaMap, type Payload } from 'payload'\nimport { getFromImportMap } from 'payload/shared'\n\nimport type { FeatureProviderProviderClient } from '../features/typesClient.js'\nimport type { SanitizedServerEditorConfig } from '../lexical/config/types.js'\nimport type { FeatureClientSchemaMap, LexicalRichTextFieldProps } from '../types.js'\ntype Args = {\n clientFieldSchemaMap: ClientFieldSchemaMap\n fieldSchemaMap: FieldSchemaMap\n i18n: I18nClient\n path: string\n payload: Payload\n sanitizedEditorConfig: SanitizedServerEditorConfig\n schemaPath: string\n}\n\nexport function initLexicalFeatures(args: Args): {\n clientFeatures: LexicalRichTextFieldProps['clientFeatures']\n featureClientImportMap: Record<string, any>\n featureClientSchemaMap: FeatureClientSchemaMap\n} {\n const clientFeatures: LexicalRichTextFieldProps['clientFeatures'] = {}\n\n // turn args.resolvedFeatureMap into an array of [key, value] pairs, ordered by value.order, lowest order first:\n const resolvedFeatureMapArray = Array.from(\n args.sanitizedEditorConfig.resolvedFeatureMap.entries(),\n ).sort((a, b) => a[1].order - b[1].order)\n\n const featureClientSchemaMap: FeatureClientSchemaMap = {}\n\n /**\n * All modules added to the import map, keyed by the provided key, if feature.componentImports with type object is used\n */\n const featureClientImportMap: Record<string, any> = {}\n\n for (const [featureKey, resolvedFeature] of resolvedFeatureMapArray) {\n clientFeatures[featureKey] = {}\n\n /**\n * Handle client features\n */\n const ClientFeaturePayloadComponent = resolvedFeature.ClientFeature\n\n if (ClientFeaturePayloadComponent) {\n const clientFeatureProvider = getFromImportMap<FeatureProviderProviderClient>({\n importMap: args.payload.importMap,\n PayloadComponent: ClientFeaturePayloadComponent,\n schemaPath: 'lexical-clientComponent',\n silent: true,\n })\n\n if (!clientFeatureProvider) {\n continue\n }\n\n const clientFeatureProps = resolvedFeature.clientFeatureProps ?? {}\n clientFeatureProps.featureKey = resolvedFeature.key\n clientFeatureProps.order = resolvedFeature.order\n if (\n typeof ClientFeaturePayloadComponent === 'object' &&\n ClientFeaturePayloadComponent.clientProps\n ) {\n clientFeatureProps.clientProps = ClientFeaturePayloadComponent.clientProps\n }\n\n // As clientFeatureProvider is a client function, we cannot execute it on the server here. Thus, the client will have to execute clientFeatureProvider with its props\n clientFeatures[featureKey] = { clientFeatureProps, clientFeatureProvider }\n }\n\n /**\n * Handle sub-fields (formstate of those)\n */\n // The args.fieldSchemaMap generated before in buildFormState should contain all of lexical features' sub-field schemas\n // as well, as it already called feature.generateSchemaMap for each feature.\n // We will check for the existance resolvedFeature.generateSchemaMap to skip unnecessary loops for constructing featureSchemaMap, but we don't run it here\n if (resolvedFeature.generateSchemaMap) {\n const featureSchemaPath = [\n ...args.schemaPath.split('.'),\n 'lexical_internal_feature',\n featureKey,\n ].join('.')\n\n featureClientSchemaMap[featureKey] = {}\n\n // Like args.fieldSchemaMap, we only want to include the sub-fields of the current feature\n for (const [key, entry] of args.clientFieldSchemaMap.entries()) {\n if (key.startsWith(featureSchemaPath)) {\n featureClientSchemaMap[featureKey][key] = 'fields' in entry ? entry.fields : [entry]\n }\n }\n if (\n resolvedFeature.componentImports &&\n typeof resolvedFeature.componentImports === 'object'\n ) {\n for (const key in resolvedFeature.componentImports) {\n const payloadComponent = resolvedFeature.componentImports[key]\n\n const resolvedComponent = getFromImportMap({\n importMap: args.payload.importMap,\n PayloadComponent: payloadComponent,\n schemaPath: 'lexical-clientComponent',\n silent: true,\n })\n\n featureClientImportMap[`${resolvedFeature.key}.${key}`] = resolvedComponent\n }\n }\n }\n }\n return {\n clientFeatures,\n featureClientImportMap,\n featureClientSchemaMap,\n }\n}\n"],"mappings":"AAGA,SAASA,gBAAgB,QAAQ;AAejC,OAAO,SAASC,oBAAoBC,IAAU;EAK5C,MAAMC,cAAA,GAA8D,CAAC;EAErE;EACA,MAAMC,uBAAA,GAA0BC,KAAA,CAAMC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CACD,CAACgB,IAAI,CAAC;MAEPlB,sBAAsB,CAACE,UAAA,CAAW,GAAG,CAAC;MAEtC;MACA,KAAK,MAAM,CAACW,GAAA,EAAKM,KAAA,CAAM,IAAI/B,IAAA,CAAKgC,oBAAoB,CAACzB,OAAO,IAAI;QAC9D,IAAIkB,GAAA,CAAIQ,UAAU,CAACL,iBAAA,GAAoB;UACrChB,sBAAsB,CAACE,UAAA,CAAW,CAACW,GAAA,CAAI,GAAG,YAAYM,KAAA,GAAQA,KAAA,CAAMG,MAAM,GAAG,CAACH,KAAA,CAAM;QACtF;MACF;MACA,IACEhB,eAAA,CAAgBoB,gBAAgB,IAChC,OAAOpB,eAAA,CAAgBoB,gBAAgB,KAAK,UAC5C;QACA,KAAK,MAAMV,GAAA,IAAOV,eAAA,CAAgBoB,gBAAgB,EAAE;UAClD,MAAMC,gBAAA,GAAmBrB,eAAA,CAAgBoB,gBAAgB,CAACV,GAAA,CAAI;UAE9D,MAAMY,iBAAA,GAAoBvC,gBAAA,CAAiB;YACzCqB,SAAA,EAAWnB,IAAA,CAAKoB,OAAO,CAACD,SAAS;YACjCE,gBAAA,EAAkBe,gBAAA;YAClBd,UAAA,EAAY;YACZC,MAAA,EAAQ;UACV;UAEAV,sBAAsB,CAAC,GAAGE,eAAA,CAAgBU,GAAG,IAAIA,GAAA,EAAK,CAAC,GAAGY,iBAAA;QAC5D;MACF;IACF;EACF;EACA,OAAO;IACLpC,cAAA;IACAY,sBAAA;IACAD;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"initLexicalFeatures.js","names":["getFromImportMap","initLexicalFeatures","args","clientFeatures","resolvedFeatureMapArray","sanitizedEditorConfig","resolvedFeatureMap","sort","a","b","order","featureClientSchemaMap","featureClientImportMap","featureKey","resolvedFeature","ClientFeaturePayloadComponent","ClientFeature","clientFeatureProvider","importMap","payload","PayloadComponent","schemaPath","silent","clientFeatureProps","key","clientProps","generateSchemaMap","featureSchemaPath","entry","clientFieldSchemaMap","entries","startsWith","fields","componentImports","Array","isArray","payloadComponent","Object","resolvedComponent"],"sources":["../../src/utilities/initLexicalFeatures.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\n\nimport { type ClientFieldSchemaMap, type FieldSchemaMap, type Payload } from 'payload'\nimport { getFromImportMap } from 'payload/shared'\n\nimport type {\n BaseClientFeatureProps,\n FeatureProviderProviderClient,\n} from '../features/typesClient.js'\nimport type { SanitizedServerEditorConfig } from '../lexical/config/types.js'\nimport type { FeatureClientSchemaMap, LexicalRichTextFieldProps } from '../types.js'\ntype Args = {\n clientFieldSchemaMap: ClientFieldSchemaMap\n fieldSchemaMap: FieldSchemaMap\n i18n: I18nClient\n path: string\n payload: Payload\n sanitizedEditorConfig: SanitizedServerEditorConfig\n schemaPath: string\n}\n\nexport function initLexicalFeatures(args: Args): {\n clientFeatures: LexicalRichTextFieldProps['clientFeatures']\n featureClientImportMap: Record<string, any>\n featureClientSchemaMap: FeatureClientSchemaMap\n} {\n const clientFeatures: LexicalRichTextFieldProps['clientFeatures'] = {}\n\n // turn args.resolvedFeatureMap into an array of [key, value] pairs, ordered by value.order, lowest order first:\n const resolvedFeatureMapArray = [...args.sanitizedEditorConfig.resolvedFeatureMap].sort(\n (a, b) => a[1].order - b[1].order,\n )\n\n const featureClientSchemaMap: FeatureClientSchemaMap = {}\n\n /**\n * All modules added to the import map, keyed by the provided key, if feature.componentImports with type object is used\n */\n const featureClientImportMap: Record<string, any> | undefined = {}\n\n for (const [featureKey, resolvedFeature] of resolvedFeatureMapArray) {\n clientFeatures[featureKey] = {}\n\n /**\n * Handle client features\n */\n const ClientFeaturePayloadComponent = resolvedFeature.ClientFeature\n\n if (ClientFeaturePayloadComponent) {\n const clientFeatureProvider = getFromImportMap<FeatureProviderProviderClient>({\n importMap: args.payload.importMap,\n PayloadComponent: ClientFeaturePayloadComponent,\n schemaPath: 'lexical-clientComponent',\n silent: true,\n })\n\n if (!clientFeatureProvider) {\n continue\n }\n\n const clientFeatureProps: BaseClientFeatureProps<Record<string, any>> =\n resolvedFeature.clientFeatureProps ?? {}\n clientFeatureProps.featureKey = resolvedFeature.key\n clientFeatureProps.order = resolvedFeature.order\n if (\n typeof ClientFeaturePayloadComponent === 'object' &&\n ClientFeaturePayloadComponent.clientProps\n ) {\n clientFeatureProps.clientProps = ClientFeaturePayloadComponent.clientProps\n }\n // As clientFeatureProvider is a client function, we cannot execute it on the server here. Thus, the client will have to execute clientFeatureProvider with its props\n clientFeatures[featureKey] = { clientFeatureProps, clientFeatureProvider }\n }\n\n /**\n * Handle sub-fields (formstate of those)\n */\n // The args.fieldSchemaMap generated before in buildFormState should contain all of lexical features' sub-field schemas\n // as well, as it already called feature.generateSchemaMap for each feature.\n // We will check for the existance resolvedFeature.generateSchemaMap to skip unnecessary loops for constructing featureSchemaMap, but we don't run it here\n if (resolvedFeature.generateSchemaMap) {\n const featureSchemaPath = `${args.schemaPath}.lexical_internal_feature.${featureKey}`\n\n featureClientSchemaMap[featureKey] = {}\n\n // Like args.fieldSchemaMap, we only want to include the sub-fields of the current feature\n for (const [key, entry] of args.clientFieldSchemaMap.entries()) {\n if (key.startsWith(featureSchemaPath)) {\n featureClientSchemaMap[featureKey][key] = 'fields' in entry ? entry.fields : [entry]\n }\n }\n }\n\n if (\n resolvedFeature.componentImports &&\n typeof resolvedFeature.componentImports === 'object' &&\n !Array.isArray(resolvedFeature.componentImports)\n ) {\n for (const [key, payloadComponent] of Object.entries(resolvedFeature.componentImports)) {\n const resolvedComponent = getFromImportMap({\n importMap: args.payload.importMap,\n PayloadComponent: payloadComponent,\n schemaPath: 'lexical-clientComponent',\n silent: true,\n })\n\n featureClientImportMap[`${resolvedFeature.key}.${key}`] = resolvedComponent\n }\n }\n }\n return {\n clientFeatures,\n featureClientImportMap,\n featureClientSchemaMap,\n }\n}\n"],"mappings":"AAGA,SAASA,gBAAgB,QAAQ;AAkBjC,OAAO,SAASC,oBAAoBC,IAAU;EAK5C,MAAMC,cAAA,GAA8D,CAAC;EAErE;E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sBAAsB,CAACE,UAAA,CAAW,GAAG,CAAC;MAEtC;MACA,KAAK,MAAM,CAACW,GAAA,EAAKI,KAAA,CAAM,IAAI1B,IAAA,CAAK2B,oBAAoB,CAACC,OAAO,IAAI;QAC9D,IAAIN,GAAA,CAAIO,UAAU,CAACJ,iBAAA,GAAoB;UACrChB,sBAAsB,CAACE,UAAA,CAAW,CAACW,GAAA,CAAI,GAAG,YAAYI,KAAA,GAAQA,KAAA,CAAMI,MAAM,GAAG,CAACJ,KAAA,CAAM;QACtF;MACF;IACF;IAEA,IACEd,eAAA,CAAgBmB,gBAAgB,IAChC,OAAOnB,eAAA,CAAgBmB,gBAAgB,KAAK,YAC5C,CAACC,KAAA,CAAMC,OAAO,CAACrB,eAAA,CAAgBmB,gBAAgB,GAC/C;MACA,KAAK,MAAM,CAACT,GAAA,EAAKY,gBAAA,CAAiB,IAAIC,MAAA,CAAOP,OAAO,CAAChB,eAAA,CAAgBmB,gBAAgB,GAAG;QACtF,MAAMK,iBAAA,GAAoBtC,gBAAA,CAAiB;UACzCkB,SAAA,EAAWhB,IAAA,CAAKiB,OAAO,CAACD,SAAS;UACjCE,gBAAA,EAAkBgB,gBAAA;UAClBf,UAAA,EAAY;UACZC,MAAA,EAAQ;QACV;QAEAV,sBAAsB,CAAC,GAAGE,eAAA,CAAgBU,GAAG,IAAIA,GAAA,EAAK,CAAC,GAAGc,iBAAA;MAC5D;IACF;EACF;EACA,OAAO;IACLnC,cAAA;IACAS,sBAAA;IACAD;EACF;AACF","ignoreList":[]}
@@ -1,3 +1,8 @@
1
1
  import type { SerializedEditorState, SerializedLexicalNode } from 'lexical';
2
- export declare function hasText(value: null | SerializedEditorState<SerializedLexicalNode> | undefined): boolean;
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>;
3
8
  //# 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,wBAAgB,OAAO,CACrB,KAAK,EAAE,IAAI,GAAG,qBAAqB,CAAC,qBAAqB,CAAC,GAAG,SAAS,GACrE,OAAO,CA0BT"}
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,5 +1,12 @@
1
- export function hasText(value) {
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) {
2
6
  const hasChildren = !!value?.root?.children?.length;
7
+ if (!hasChildren) {
8
+ return false;
9
+ }
3
10
  let hasOnlyEmptyParagraph = false;
4
11
  if (value?.root?.children?.length === 1) {
5
12
  if (value?.root?.children[0]?.type === 'paragraph') {
@@ -16,10 +23,9 @@ export function hasText(value) {
16
23
  }
17
24
  }
18
25
  }
19
- if (!hasChildren || hasOnlyEmptyParagraph) {
26
+ if (hasOnlyEmptyParagraph) {
20
27
  return false;
21
- } else {
22
- return true;
23
28
  }
29
+ return true;
24
30
  }
25
31
  //# 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\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":[]}
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":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/richtext-lexical",
3
- "version": "3.61.0-internal.c252d14",
3
+ "version": "3.61.0-internal.dd40839",
4
4
  "description": "The officially supported Lexical richtext adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -374,8 +374,8 @@
374
374
  "react-error-boundary": "4.1.2",
375
375
  "ts-essentials": "10.0.3",
376
376
  "uuid": "10.0.0",
377
- "@payloadcms/ui": "3.61.0-internal.c252d14",
378
- "@payloadcms/translations": "3.61.0-internal.c252d14"
377
+ "@payloadcms/translations": "3.61.0-internal.dd40839",
378
+ "@payloadcms/ui": "3.61.0-internal.dd40839"
379
379
  },
380
380
  "devDependencies": {
381
381
  "@babel/cli": "7.27.2",
@@ -394,16 +394,16 @@
394
394
  "esbuild": "0.25.5",
395
395
  "esbuild-sass-plugin": "3.3.1",
396
396
  "swc-plugin-transform-remove-imports": "4.0.4",
397
- "payload": "3.61.0-internal.c252d14",
398
- "@payloadcms/eslint-config": "3.28.0"
397
+ "@payloadcms/eslint-config": "3.28.0",
398
+ "payload": "3.61.0-internal.dd40839"
399
399
  },
400
400
  "peerDependencies": {
401
401
  "@faceless-ui/modal": "3.0.0",
402
402
  "@faceless-ui/scroll-info": "2.0.0",
403
403
  "react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
404
404
  "react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
405
- "@payloadcms/next": "3.61.0-internal.c252d14",
406
- "payload": "3.61.0-internal.c252d14"
405
+ "@payloadcms/next": "3.61.0-internal.dd40839",
406
+ "payload": "3.61.0-internal.dd40839"
407
407
  },
408
408
  "engines": {
409
409
  "node": "^18.20.2 || >=20.9.0"