@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.
- package/dist/field/features/blocks/feature.server.d.ts.map +1 -1
- package/dist/field/features/blocks/feature.server.js +28 -68
- package/dist/field/features/blocks/feature.server.js.map +1 -1
- package/dist/field/features/blocks/populationPromise.d.ts.map +1 -1
- package/dist/field/features/blocks/populationPromise.js +0 -13
- package/dist/field/features/blocks/populationPromise.js.map +1 -1
- package/dist/field/features/blocks/validate.d.ts.map +1 -1
- package/dist/field/features/blocks/validate.js +2 -14
- package/dist/field/features/blocks/validate.js.map +1 -1
- package/dist/field/features/link/drawer/baseFields.d.ts +3 -3
- package/dist/field/features/link/drawer/baseFields.d.ts.map +1 -1
- package/dist/field/features/link/drawer/baseFields.js +28 -42
- package/dist/field/features/link/drawer/baseFields.js.map +1 -1
- package/dist/field/features/link/drawer/types.d.ts +4 -2
- package/dist/field/features/link/drawer/types.d.ts.map +1 -1
- package/dist/field/features/link/drawer/types.js.map +1 -1
- package/dist/field/features/link/feature.server.d.ts +0 -2
- package/dist/field/features/link/feature.server.d.ts.map +1 -1
- package/dist/field/features/link/feature.server.js +22 -6
- package/dist/field/features/link/feature.server.js.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.js +38 -24
- package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/index.scss +9 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/utilities.d.ts +3 -5
- package/dist/field/features/link/plugins/floatingLinkEditor/utilities.d.ts.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/utilities.js +11 -29
- package/dist/field/features/link/plugins/floatingLinkEditor/utilities.js.map +1 -1
- package/dist/field/features/link/plugins/link/index.d.ts.map +1 -1
- package/dist/field/features/link/plugins/link/index.js +0 -6
- package/dist/field/features/link/plugins/link/index.js.map +1 -1
- package/dist/field/features/link/populationPromise.d.ts.map +1 -1
- package/dist/field/features/link/populationPromise.js +5 -23
- package/dist/field/features/link/populationPromise.js.map +1 -1
- package/dist/field/features/link/validate.d.ts +5 -0
- package/dist/field/features/link/validate.d.ts.map +1 -0
- package/dist/field/features/link/validate.js +32 -0
- package/dist/field/features/link/validate.js.map +1 -0
- package/dist/field/features/relationship/nodes/components/RelationshipComponent.d.ts.map +1 -1
- package/dist/field/features/relationship/nodes/components/RelationshipComponent.js +51 -2
- package/dist/field/features/relationship/nodes/components/RelationshipComponent.js.map +1 -1
- package/dist/field/features/types.d.ts +5 -1
- package/dist/field/features/types.d.ts.map +1 -1
- package/dist/field/features/types.js.map +1 -1
- package/dist/field/features/upload/feature.server.d.ts.map +1 -1
- package/dist/field/features/upload/feature.server.js +14 -2
- package/dist/field/features/upload/feature.server.js.map +1 -1
- package/dist/field/features/upload/populationPromise.d.ts.map +1 -1
- package/dist/field/features/upload/populationPromise.js +2 -12
- package/dist/field/features/upload/populationPromise.js.map +1 -1
- package/dist/field/features/upload/validate.d.ts +2 -1
- package/dist/field/features/upload/validate.d.ts.map +1 -1
- package/dist/field/features/upload/validate.js +33 -11
- package/dist/field/features/upload/validate.js.map +1 -1
- package/dist/field/lexical/LexicalEditor.js +1 -1
- package/dist/field/lexical/LexicalEditor.js.map +1 -1
- package/dist/field/lexical/config/server/default.d.ts +1 -2
- package/dist/field/lexical/config/server/default.d.ts.map +1 -1
- package/dist/field/lexical/config/server/default.js +0 -2
- package/dist/field/lexical/config/server/default.js.map +1 -1
- package/dist/field/lexical/config/server/loader.d.ts +4 -2
- package/dist/field/lexical/config/server/loader.d.ts.map +1 -1
- package/dist/field/lexical/config/server/loader.js +3 -2
- package/dist/field/lexical/config/server/loader.js.map +1 -1
- package/dist/field/lexical/config/server/sanitize.d.ts +2 -1
- package/dist/field/lexical/config/server/sanitize.d.ts.map +1 -1
- package/dist/field/lexical/config/server/sanitize.js +3 -2
- package/dist/field/lexical/config/server/sanitize.js.map +1 -1
- package/dist/field/lexical/plugins/FloatingSelectToolbar/index.d.ts.map +1 -1
- package/dist/field/lexical/plugins/FloatingSelectToolbar/index.js +24 -23
- package/dist/field/lexical/plugins/FloatingSelectToolbar/index.js.map +1 -1
- package/dist/field/lexical/utils/setFloatingElemPosition.d.ts +1 -1
- package/dist/field/lexical/utils/setFloatingElemPosition.d.ts.map +1 -1
- package/dist/field/lexical/utils/setFloatingElemPosition.js +15 -13
- package/dist/field/lexical/utils/setFloatingElemPosition.js.map +1 -1
- package/dist/field/lexical/utils/url.d.ts.map +1 -1
- package/dist/field/lexical/utils/url.js +2 -0
- package/dist/field/lexical/utils/url.js.map +1 -1
- package/dist/generateComponentMap.d.ts.map +1 -1
- package/dist/generateComponentMap.js +1 -10
- package/dist/generateComponentMap.js.map +1 -1
- package/dist/generateSchemaMap.d.ts.map +1 -1
- package/dist/generateSchemaMap.js +1 -10
- package/dist/generateSchemaMap.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +241 -234
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +8 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- 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
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
|
|
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
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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
|
-
|
|
97
|
-
})
|
|
101
|
+
},
|
|
102
|
+
nodes: (value as SerializedEditorState)?.root?.children ?? [],
|
|
103
|
+
})
|
|
98
104
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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
|
-
|
|
114
|
-
})
|
|
118
|
+
},
|
|
119
|
+
nodes: (value as SerializedEditorState)?.root?.children ?? [],
|
|
120
|
+
})
|
|
115
121
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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
|
-
|
|
131
|
-
})
|
|
135
|
+
},
|
|
136
|
+
nodes: (value as SerializedEditorState)?.root?.children ?? [],
|
|
137
|
+
})
|
|
132
138
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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
|
-
|
|
181
|
-
type
|
|
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
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
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
|
|
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';
|