@payloadcms/richtext-lexical 3.0.0-beta.20 → 3.0.0-beta.21

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 (92) hide show
  1. package/dist/field/features/blocks/feature.server.d.ts.map +1 -1
  2. package/dist/field/features/blocks/feature.server.js +28 -68
  3. package/dist/field/features/blocks/feature.server.js.map +1 -1
  4. package/dist/field/features/blocks/populationPromise.d.ts.map +1 -1
  5. package/dist/field/features/blocks/populationPromise.js +0 -13
  6. package/dist/field/features/blocks/populationPromise.js.map +1 -1
  7. package/dist/field/features/blocks/validate.d.ts.map +1 -1
  8. package/dist/field/features/blocks/validate.js +2 -14
  9. package/dist/field/features/blocks/validate.js.map +1 -1
  10. package/dist/field/features/link/drawer/baseFields.d.ts +3 -3
  11. package/dist/field/features/link/drawer/baseFields.d.ts.map +1 -1
  12. package/dist/field/features/link/drawer/baseFields.js +28 -42
  13. package/dist/field/features/link/drawer/baseFields.js.map +1 -1
  14. package/dist/field/features/link/drawer/types.d.ts +4 -2
  15. package/dist/field/features/link/drawer/types.d.ts.map +1 -1
  16. package/dist/field/features/link/drawer/types.js.map +1 -1
  17. package/dist/field/features/link/feature.server.d.ts +0 -2
  18. package/dist/field/features/link/feature.server.d.ts.map +1 -1
  19. package/dist/field/features/link/feature.server.js +22 -6
  20. package/dist/field/features/link/feature.server.js.map +1 -1
  21. package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  22. package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.js +38 -24
  23. package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  24. package/dist/field/features/link/plugins/floatingLinkEditor/index.scss +9 -1
  25. package/dist/field/features/link/plugins/floatingLinkEditor/utilities.d.ts +3 -5
  26. package/dist/field/features/link/plugins/floatingLinkEditor/utilities.d.ts.map +1 -1
  27. package/dist/field/features/link/plugins/floatingLinkEditor/utilities.js +11 -29
  28. package/dist/field/features/link/plugins/floatingLinkEditor/utilities.js.map +1 -1
  29. package/dist/field/features/link/plugins/link/index.d.ts.map +1 -1
  30. package/dist/field/features/link/plugins/link/index.js +0 -6
  31. package/dist/field/features/link/plugins/link/index.js.map +1 -1
  32. package/dist/field/features/link/populationPromise.d.ts.map +1 -1
  33. package/dist/field/features/link/populationPromise.js +5 -23
  34. package/dist/field/features/link/populationPromise.js.map +1 -1
  35. package/dist/field/features/link/validate.d.ts +5 -0
  36. package/dist/field/features/link/validate.d.ts.map +1 -0
  37. package/dist/field/features/link/validate.js +32 -0
  38. package/dist/field/features/link/validate.js.map +1 -0
  39. package/dist/field/features/relationship/nodes/components/RelationshipComponent.d.ts.map +1 -1
  40. package/dist/field/features/relationship/nodes/components/RelationshipComponent.js +51 -2
  41. package/dist/field/features/relationship/nodes/components/RelationshipComponent.js.map +1 -1
  42. package/dist/field/features/types.d.ts +5 -1
  43. package/dist/field/features/types.d.ts.map +1 -1
  44. package/dist/field/features/types.js.map +1 -1
  45. package/dist/field/features/upload/feature.server.d.ts.map +1 -1
  46. package/dist/field/features/upload/feature.server.js +14 -2
  47. package/dist/field/features/upload/feature.server.js.map +1 -1
  48. package/dist/field/features/upload/populationPromise.d.ts.map +1 -1
  49. package/dist/field/features/upload/populationPromise.js +2 -12
  50. package/dist/field/features/upload/populationPromise.js.map +1 -1
  51. package/dist/field/features/upload/validate.d.ts +2 -1
  52. package/dist/field/features/upload/validate.d.ts.map +1 -1
  53. package/dist/field/features/upload/validate.js +33 -11
  54. package/dist/field/features/upload/validate.js.map +1 -1
  55. package/dist/field/lexical/LexicalEditor.js +1 -1
  56. package/dist/field/lexical/LexicalEditor.js.map +1 -1
  57. package/dist/field/lexical/config/server/default.d.ts +1 -2
  58. package/dist/field/lexical/config/server/default.d.ts.map +1 -1
  59. package/dist/field/lexical/config/server/default.js +0 -2
  60. package/dist/field/lexical/config/server/default.js.map +1 -1
  61. package/dist/field/lexical/config/server/loader.d.ts +4 -2
  62. package/dist/field/lexical/config/server/loader.d.ts.map +1 -1
  63. package/dist/field/lexical/config/server/loader.js +3 -2
  64. package/dist/field/lexical/config/server/loader.js.map +1 -1
  65. package/dist/field/lexical/config/server/sanitize.d.ts +2 -1
  66. package/dist/field/lexical/config/server/sanitize.d.ts.map +1 -1
  67. package/dist/field/lexical/config/server/sanitize.js +3 -2
  68. package/dist/field/lexical/config/server/sanitize.js.map +1 -1
  69. package/dist/field/lexical/plugins/FloatingSelectToolbar/index.d.ts.map +1 -1
  70. package/dist/field/lexical/plugins/FloatingSelectToolbar/index.js +24 -23
  71. package/dist/field/lexical/plugins/FloatingSelectToolbar/index.js.map +1 -1
  72. package/dist/field/lexical/utils/setFloatingElemPosition.d.ts +1 -1
  73. package/dist/field/lexical/utils/setFloatingElemPosition.d.ts.map +1 -1
  74. package/dist/field/lexical/utils/setFloatingElemPosition.js +15 -13
  75. package/dist/field/lexical/utils/setFloatingElemPosition.js.map +1 -1
  76. package/dist/field/lexical/utils/url.d.ts.map +1 -1
  77. package/dist/field/lexical/utils/url.js +2 -0
  78. package/dist/field/lexical/utils/url.js.map +1 -1
  79. package/dist/generateComponentMap.d.ts.map +1 -1
  80. package/dist/generateComponentMap.js +1 -10
  81. package/dist/generateComponentMap.js.map +1 -1
  82. package/dist/generateSchemaMap.d.ts.map +1 -1
  83. package/dist/generateSchemaMap.js +1 -10
  84. package/dist/generateSchemaMap.js.map +1 -1
  85. package/dist/index.d.ts +3 -3
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/index.js +241 -234
  88. package/dist/index.js.map +1 -1
  89. package/dist/types.d.ts +8 -1
  90. package/dist/types.d.ts.map +1 -1
  91. package/dist/types.js.map +1 -1
  92. package/package.json +9 -9
package/dist/index.js CHANGED
@@ -2,147 +2,153 @@ import { withMergedProps } from '@payloadcms/ui/elements/withMergedProps';
2
2
  import { withNullableJSONSchemaType } from 'payload/utilities';
3
3
  import { RichTextCell } from './cell/index.js';
4
4
  import { RichTextField } from './field/index.js';
5
- import { defaultEditorConfig, defaultEditorFeatures, defaultSanitizedServerEditorConfig } from './field/lexical/config/server/default.js';
5
+ import { defaultEditorConfig, defaultEditorFeatures } from './field/lexical/config/server/default.js';
6
6
  import { loadFeatures } from './field/lexical/config/server/loader.js';
7
- import { sanitizeServerFeatures } from './field/lexical/config/server/sanitize.js';
7
+ import { sanitizeServerEditorConfig, sanitizeServerFeatures } from './field/lexical/config/server/sanitize.js';
8
8
  import { cloneDeep } from './field/lexical/utils/cloneDeep.js';
9
9
  import { getGenerateComponentMap } from './generateComponentMap.js';
10
10
  import { getGenerateSchemaMap } from './generateSchemaMap.js';
11
11
  import { populateLexicalPopulationPromises } from './populate/populateLexicalPopulationPromises.js';
12
12
  import { richTextValidateHOC } from './validate/index.js';
13
+ let defaultSanitizedServerEditorConfig = null;
13
14
  export function lexicalEditor(props) {
14
- let resolvedFeatureMap = null;
15
- let finalSanitizedEditorConfig// For server only
16
- ;
17
- if (!props || !props.features && !props.lexical) {
18
- finalSanitizedEditorConfig = cloneDeep(defaultSanitizedServerEditorConfig);
19
- resolvedFeatureMap = finalSanitizedEditorConfig.resolvedFeatureMap;
20
- } else {
21
- let features = props.features && typeof props.features === 'function' ? props.features({
22
- defaultFeatures: cloneDeep(defaultEditorFeatures)
23
- }) : props.features;
24
- if (!features) {
25
- features = cloneDeep(defaultEditorFeatures);
26
- }
27
- const lexical = props.lexical;
28
- resolvedFeatureMap = loadFeatures({
29
- unSanitizedEditorConfig: {
30
- features,
31
- lexical: lexical ? lexical : defaultEditorConfig.lexical
32
- }
33
- });
34
- finalSanitizedEditorConfig = {
35
- features: sanitizeServerFeatures(resolvedFeatureMap),
36
- lexical: lexical ? lexical : defaultEditorConfig.lexical,
37
- resolvedFeatureMap
38
- };
39
- }
40
- return {
41
- CellComponent: withMergedProps({
42
- Component: RichTextCell,
43
- toMergeIntoProps: {
44
- lexicalEditorConfig: finalSanitizedEditorConfig.lexical
15
+ return async ({ config })=>{
16
+ let resolvedFeatureMap = null;
17
+ let finalSanitizedEditorConfig// For server only
18
+ ;
19
+ if (!props || !props.features && !props.lexical) {
20
+ if (!defaultSanitizedServerEditorConfig) {
21
+ defaultSanitizedServerEditorConfig = await sanitizeServerEditorConfig(defaultEditorConfig, config);
45
22
  }
46
- }),
47
- FieldComponent: withMergedProps({
48
- Component: RichTextField,
49
- toMergeIntoProps: {
50
- lexicalEditorConfig: finalSanitizedEditorConfig.lexical
23
+ finalSanitizedEditorConfig = cloneDeep(defaultSanitizedServerEditorConfig);
24
+ resolvedFeatureMap = finalSanitizedEditorConfig.resolvedFeatureMap;
25
+ } else {
26
+ let features = props.features && typeof props.features === 'function' ? props.features({
27
+ defaultFeatures: cloneDeep(defaultEditorFeatures)
28
+ }) : props.features;
29
+ if (!features) {
30
+ features = cloneDeep(defaultEditorFeatures);
51
31
  }
52
- }),
53
- editorConfig: finalSanitizedEditorConfig,
54
- generateComponentMap: getGenerateComponentMap({
55
- resolvedFeatureMap
56
- }),
57
- generateSchemaMap: getGenerateSchemaMap({
58
- resolvedFeatureMap
59
- }),
60
- /* hooks: {
61
- afterChange: finalSanitizedEditorConfig.features.hooks.afterChange,
62
- afterRead: finalSanitizedEditorConfig.features.hooks.afterRead,
63
- beforeChange: finalSanitizedEditorConfig.features.hooks.beforeChange,
64
- beforeDuplicate: finalSanitizedEditorConfig.features.hooks.beforeDuplicate,
65
- beforeValidate: finalSanitizedEditorConfig.features.hooks.beforeValidate,
66
- },*/ /* // TODO: Figure out docWithLocales / originalSiblingDoc => node matching. Can't use indexes, as the order of nodes could technically change between hooks.
67
- hooks: {
68
- afterChange: [
69
- async ({ context, findMany, operation, overrideAccess, req, value }) => {
70
- await recurseNodesAsync({
71
- callback: async (node) => {
72
- const afterChangeHooks = finalSanitizedEditorConfig.features.hooks.afterChange
73
- if (afterChangeHooks?.has(node.type)) {
74
- for (const hook of afterChangeHooks.get(node.type)) {
75
- node = await hook({ context, findMany, node, operation, overrideAccess, req })
32
+ const lexical = props.lexical;
33
+ resolvedFeatureMap = await loadFeatures({
34
+ config,
35
+ unSanitizedEditorConfig: {
36
+ features,
37
+ lexical: lexical ? lexical : defaultEditorConfig.lexical
76
38
  }
77
- }
78
- },
79
- nodes: (value as SerializedEditorState)?.root?.children ?? [],
80
- })
39
+ });
40
+ finalSanitizedEditorConfig = {
41
+ features: sanitizeServerFeatures(resolvedFeatureMap),
42
+ lexical: lexical ? lexical : defaultEditorConfig.lexical,
43
+ resolvedFeatureMap
44
+ };
45
+ }
46
+ return {
47
+ CellComponent: withMergedProps({
48
+ Component: RichTextCell,
49
+ toMergeIntoProps: {
50
+ lexicalEditorConfig: finalSanitizedEditorConfig.lexical
51
+ }
52
+ }),
53
+ FieldComponent: withMergedProps({
54
+ Component: RichTextField,
55
+ toMergeIntoProps: {
56
+ lexicalEditorConfig: finalSanitizedEditorConfig.lexical
57
+ }
58
+ }),
59
+ editorConfig: finalSanitizedEditorConfig,
60
+ generateComponentMap: getGenerateComponentMap({
61
+ resolvedFeatureMap
62
+ }),
63
+ generateSchemaMap: getGenerateSchemaMap({
64
+ resolvedFeatureMap
65
+ }),
66
+ /* hooks: {
67
+ afterChange: finalSanitizedEditorConfig.features.hooks.afterChange,
68
+ afterRead: finalSanitizedEditorConfig.features.hooks.afterRead,
69
+ beforeChange: finalSanitizedEditorConfig.features.hooks.beforeChange,
70
+ beforeDuplicate: finalSanitizedEditorConfig.features.hooks.beforeDuplicate,
71
+ beforeValidate: finalSanitizedEditorConfig.features.hooks.beforeValidate,
72
+ },*/ /* // TODO: Figure out docWithLocales / originalSiblingDoc => node matching. Can't use indexes, as the order of nodes could technically change between hooks.
73
+ hooks: {
74
+ afterChange: [
75
+ async ({ context, findMany, operation, overrideAccess, req, value }) => {
76
+ await recurseNodesAsync({
77
+ callback: async (node) => {
78
+ const afterChangeHooks = finalSanitizedEditorConfig.features.hooks.afterChange
79
+ if (afterChangeHooks?.has(node.type)) {
80
+ for (const hook of afterChangeHooks.get(node.type)) {
81
+ node = await hook({ context, findMany, node, operation, overrideAccess, req })
82
+ }
83
+ }
84
+ },
85
+ nodes: (value as SerializedEditorState)?.root?.children ?? [],
86
+ })
81
87
 
82
- return value
83
- },
84
- ],
85
- afterRead: [
86
- async ({ context, findMany, operation, overrideAccess, req, value }) => {
87
- await recurseNodesAsync({
88
- callback: async (node) => {
89
- const afterReadHooks = finalSanitizedEditorConfig.features.hooks.afterRead
90
- if (afterReadHooks?.has(node.type)) {
91
- for (const hook of afterReadHooks.get(node.type)) {
92
- node = await hook({ context, findMany, node, operation, overrideAccess, req })
88
+ return value
89
+ },
90
+ ],
91
+ afterRead: [
92
+ async ({ context, findMany, operation, overrideAccess, req, value }) => {
93
+ await recurseNodesAsync({
94
+ callback: async (node) => {
95
+ const afterReadHooks = finalSanitizedEditorConfig.features.hooks.afterRead
96
+ if (afterReadHooks?.has(node.type)) {
97
+ for (const hook of afterReadHooks.get(node.type)) {
98
+ node = await hook({ context, findMany, node, operation, overrideAccess, req })
99
+ }
93
100
  }
94
- }
95
- },
96
- nodes: (value as SerializedEditorState)?.root?.children ?? [],
97
- })
101
+ },
102
+ nodes: (value as SerializedEditorState)?.root?.children ?? [],
103
+ })
98
104
 
99
- return value
100
- },
101
- ],
102
- beforeChange: [
103
- async ({ context, findMany, operation, overrideAccess, req, value }) => {
104
- await recurseNodesAsync({
105
- callback: async (node) => {
106
- const beforeChangeHooks = finalSanitizedEditorConfig.features.hooks.beforeChange
107
- if (beforeChangeHooks?.has(node.type)) {
108
- for (const hook of beforeChangeHooks.get(node.type)) {
109
- node = await hook({ context, findMany, node, operation, overrideAccess, req })
105
+ return value
106
+ },
107
+ ],
108
+ beforeChange: [
109
+ async ({ context, findMany, operation, overrideAccess, req, value }) => {
110
+ await recurseNodesAsync({
111
+ callback: async (node) => {
112
+ const beforeChangeHooks = finalSanitizedEditorConfig.features.hooks.beforeChange
113
+ if (beforeChangeHooks?.has(node.type)) {
114
+ for (const hook of beforeChangeHooks.get(node.type)) {
115
+ node = await hook({ context, findMany, node, operation, overrideAccess, req })
116
+ }
110
117
  }
111
- }
112
- },
113
- nodes: (value as SerializedEditorState)?.root?.children ?? [],
114
- })
118
+ },
119
+ nodes: (value as SerializedEditorState)?.root?.children ?? [],
120
+ })
115
121
 
116
- return value
117
- },
118
- ],
119
- beforeDuplicate: [
120
- async ({ context, findMany, operation, overrideAccess, req, value }) => {
121
- await recurseNodesAsync({
122
- callback: async (node) => {
123
- const beforeDuplicateHooks = finalSanitizedEditorConfig.features.hooks.beforeDuplicate
124
- if (beforeDuplicateHooks?.has(node.type)) {
125
- for (const hook of beforeDuplicateHooks.get(node.type)) {
126
- node = await hook({ context, findMany, node, operation, overrideAccess, req })
122
+ return value
123
+ },
124
+ ],
125
+ beforeDuplicate: [
126
+ async ({ context, findMany, operation, overrideAccess, req, value }) => {
127
+ await recurseNodesAsync({
128
+ callback: async (node) => {
129
+ const beforeDuplicateHooks = finalSanitizedEditorConfig.features.hooks.beforeDuplicate
130
+ if (beforeDuplicateHooks?.has(node.type)) {
131
+ for (const hook of beforeDuplicateHooks.get(node.type)) {
132
+ node = await hook({ context, findMany, node, operation, overrideAccess, req })
133
+ }
127
134
  }
128
- }
129
- },
130
- nodes: (value as SerializedEditorState)?.root?.children ?? [],
131
- })
135
+ },
136
+ nodes: (value as SerializedEditorState)?.root?.children ?? [],
137
+ })
132
138
 
133
- return value
134
- },
135
- ],
136
- beforeValidate: [
137
- async ({ context, findMany, operation, overrideAccess, req, value }) => {
138
- await recurseNodesAsync({
139
- callback: async (node) => {
140
- const beforeValidateHooks = finalSanitizedEditorConfig.features.hooks.beforeValidate
141
- if (beforeValidateHooks?.has(node.type)) {
142
- for (const hook of beforeValidateHooks.get(node.type)) {
143
- /**
144
- * We cannot pass the originalNode here, as there is no way to map one node to a previous one, as a previous originalNode might be in a different position
145
- */ /*
139
+ return value
140
+ },
141
+ ],
142
+ beforeValidate: [
143
+ async ({ context, findMany, operation, overrideAccess, req, value }) => {
144
+ await recurseNodesAsync({
145
+ callback: async (node) => {
146
+ const beforeValidateHooks = finalSanitizedEditorConfig.features.hooks.beforeValidate
147
+ if (beforeValidateHooks?.has(node.type)) {
148
+ for (const hook of beforeValidateHooks.get(node.type)) {
149
+ /**
150
+ * We cannot pass the originalNode here, as there is no way to map one node to a previous one, as a previous originalNode might be in a different position
151
+ */ /*
146
152
  node = await hook({ context, findMany, node, operation, overrideAccess, req })
147
153
  }
148
154
  }
@@ -154,120 +160,121 @@ export function lexicalEditor(props) {
154
160
  },
155
161
  ],
156
162
  },*/ outputSchema: ({ collectionIDFieldTypes, config, field, interfaceNameDefinitions, isRequired })=>{
157
- let outputSchema = {
158
- // This schema matches the SerializedEditorState type so far, that it's possible to cast SerializedEditorState to this schema without any errors.
159
- // In the future, we should
160
- // 1) allow recursive children
161
- // 2) Pass in all the different types for every node added to the editorconfig. This can be done with refs in the schema.
162
- type: withNullableJSONSchemaType('object', isRequired),
163
- properties: {
164
- root: {
165
- type: 'object',
166
- additionalProperties: false,
167
- properties: {
168
- type: {
169
- type: 'string'
170
- },
171
- children: {
172
- type: 'array',
173
- items: {
174
- type: 'object',
175
- additionalProperties: true,
176
- properties: {
177
- type: {
178
- type: 'string'
163
+ let outputSchema = {
164
+ // This schema matches the SerializedEditorState type so far, that it's possible to cast SerializedEditorState to this schema without any errors.
165
+ // In the future, we should
166
+ // 1) allow recursive children
167
+ // 2) Pass in all the different types for every node added to the editorconfig. This can be done with refs in the schema.
168
+ type: withNullableJSONSchemaType('object', isRequired),
169
+ properties: {
170
+ root: {
171
+ type: 'object',
172
+ additionalProperties: false,
173
+ properties: {
174
+ type: {
175
+ type: 'string'
176
+ },
177
+ children: {
178
+ type: 'array',
179
+ items: {
180
+ type: 'object',
181
+ additionalProperties: true,
182
+ properties: {
183
+ type: {
184
+ type: 'string'
185
+ },
186
+ version: {
187
+ type: 'integer'
188
+ }
179
189
  },
180
- version: {
181
- type: 'integer'
190
+ required: [
191
+ 'type',
192
+ 'version'
193
+ ]
194
+ }
195
+ },
196
+ direction: {
197
+ oneOf: [
198
+ {
199
+ enum: [
200
+ 'ltr',
201
+ 'rtl'
202
+ ]
203
+ },
204
+ {
205
+ type: 'null'
182
206
  }
183
- },
184
- required: [
185
- 'type',
186
- 'version'
187
207
  ]
208
+ },
209
+ format: {
210
+ type: 'string',
211
+ enum: [
212
+ 'left',
213
+ 'start',
214
+ 'center',
215
+ 'right',
216
+ 'end',
217
+ 'justify',
218
+ ''
219
+ ]
220
+ },
221
+ indent: {
222
+ type: 'integer'
223
+ },
224
+ version: {
225
+ type: 'integer'
188
226
  }
189
227
  },
190
- direction: {
191
- oneOf: [
192
- {
193
- enum: [
194
- 'ltr',
195
- 'rtl'
196
- ]
197
- },
198
- {
199
- type: 'null'
200
- }
201
- ]
202
- },
203
- format: {
204
- type: 'string',
205
- enum: [
206
- 'left',
207
- 'start',
208
- 'center',
209
- 'right',
210
- 'end',
211
- 'justify',
212
- ''
213
- ]
214
- },
215
- indent: {
216
- type: 'integer'
217
- },
218
- version: {
219
- type: 'integer'
220
- }
221
- },
222
- required: [
223
- 'children',
224
- 'direction',
225
- 'format',
226
- 'indent',
227
- 'type',
228
- 'version'
229
- ]
230
- }
231
- },
232
- required: [
233
- 'root'
234
- ]
235
- };
236
- for (const modifyOutputSchema of finalSanitizedEditorConfig.features.generatedTypes.modifyOutputSchemas){
237
- outputSchema = modifyOutputSchema({
238
- collectionIDFieldTypes,
239
- config,
240
- currentSchema: outputSchema,
241
- field,
242
- interfaceNameDefinitions,
243
- isRequired
244
- });
245
- }
246
- return outputSchema;
247
- },
248
- populationPromises ({ context, currentDepth, depth, field, fieldPromises, findMany, flattenLocales, overrideAccess, populationPromises, req, showHiddenFields, siblingDoc }) {
249
- // check if there are any features with nodes which have populationPromises for this field
250
- if (finalSanitizedEditorConfig?.features?.populationPromises?.size) {
251
- populateLexicalPopulationPromises({
252
- context,
253
- currentDepth,
254
- depth,
255
- editorPopulationPromises: finalSanitizedEditorConfig.features.populationPromises,
256
- field,
257
- fieldPromises,
258
- findMany,
259
- flattenLocales,
260
- overrideAccess,
261
- populationPromises,
262
- req,
263
- showHiddenFields,
264
- siblingDoc
265
- });
266
- }
267
- },
268
- validate: richTextValidateHOC({
269
- editorConfig: finalSanitizedEditorConfig
270
- })
228
+ required: [
229
+ 'children',
230
+ 'direction',
231
+ 'format',
232
+ 'indent',
233
+ 'type',
234
+ 'version'
235
+ ]
236
+ }
237
+ },
238
+ required: [
239
+ 'root'
240
+ ]
241
+ };
242
+ for (const modifyOutputSchema of finalSanitizedEditorConfig.features.generatedTypes.modifyOutputSchemas){
243
+ outputSchema = modifyOutputSchema({
244
+ collectionIDFieldTypes,
245
+ config,
246
+ currentSchema: outputSchema,
247
+ field,
248
+ interfaceNameDefinitions,
249
+ isRequired
250
+ });
251
+ }
252
+ return outputSchema;
253
+ },
254
+ populationPromises ({ context, currentDepth, depth, field, fieldPromises, findMany, flattenLocales, overrideAccess, populationPromises, req, showHiddenFields, siblingDoc }) {
255
+ // check if there are any features with nodes which have populationPromises for this field
256
+ if (finalSanitizedEditorConfig?.features?.populationPromises?.size) {
257
+ populateLexicalPopulationPromises({
258
+ context,
259
+ currentDepth,
260
+ depth,
261
+ editorPopulationPromises: finalSanitizedEditorConfig.features.populationPromises,
262
+ field,
263
+ fieldPromises,
264
+ findMany,
265
+ flattenLocales,
266
+ overrideAccess,
267
+ populationPromises,
268
+ req,
269
+ showHiddenFields,
270
+ siblingDoc
271
+ });
272
+ }
273
+ },
274
+ validate: richTextValidateHOC({
275
+ editorConfig: finalSanitizedEditorConfig
276
+ })
277
+ };
271
278
  };
272
279
  }
273
280
  export { AlignFeature } from './field/features/align/feature.server.js';
@@ -324,7 +331,7 @@ export { UploadFeature } from './field/features/upload/feature.server.js';
324
331
  export { $createUploadNode, $isUploadNode, UploadNode } from './field/features/upload/nodes/UploadNode.js';
325
332
  export { EditorConfigProvider, useEditorConfigContext } from './field/lexical/config/client/EditorConfigProvider.js';
326
333
  export { sanitizeClientEditorConfig, sanitizeClientFeatures } from './field/lexical/config/client/sanitize.js';
327
- export { defaultEditorConfig, defaultEditorFeatures, defaultEditorLexicalConfig, defaultSanitizedServerEditorConfig } from './field/lexical/config/server/default.js';
334
+ export { defaultEditorConfig, defaultEditorFeatures, defaultEditorLexicalConfig } from './field/lexical/config/server/default.js';
328
335
  export { loadFeatures, sortFeaturesForOptimalLoading } from './field/lexical/config/server/loader.js';
329
336
  export { sanitizeServerEditorConfig, sanitizeServerFeatures } from './field/lexical/config/server/sanitize.js';
330
337
  export { getEnabledNodes } from './field/lexical/nodes/index.js';