Skip to content

Commit 8b0ac01

Browse files
authored
docs: add jsdocs to RichText adapter (#14246)
Adds JSDocs to the RichText adapter return value.
1 parent de5f3db commit 8b0ac01

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

packages/payload/src/admin/RichText.ts

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,17 @@ type RichTextAdapterBase<
203203
AdapterProps = any,
204204
ExtraFieldProperties = {},
205205
> = {
206+
/**
207+
* Provide a function that can be used to add items to the import map. This is useful for
208+
* making modules available to the client.
209+
*/
206210
generateImportMap?: ImportMapGenerators[0]
211+
/**
212+
* Provide a function that can be used to add items to the schema map. This is useful for
213+
* richtext sub-fields the server needs to "know" about in order to do things like calculate form state.
214+
*
215+
* This function is run within `buildFieldSchemaMap`.
216+
*/
207217
generateSchemaMap?: (args: {
208218
config: SanitizedConfig
209219
field: RichTextField
@@ -240,6 +250,11 @@ type RichTextAdapterBase<
240250
* This property will be removed in v4.
241251
*/
242252
i18n?: Partial<GenericLanguages>
253+
/**
254+
* Return the JSON schema for the field value. The JSON schema is read by
255+
* `json-schema-to-typescript` which is used to generate types for this richtext field
256+
* payload-types.ts)
257+
*/
243258
outputSchema?: (args: {
244259
collectionIDFieldTypes: { [key: string]: 'number' | 'string' }
245260
config?: SanitizedConfig
@@ -251,6 +266,10 @@ type RichTextAdapterBase<
251266
interfaceNameDefinitions: Map<string, JSONSchema4>
252267
isRequired: boolean
253268
}) => JSONSchema4
269+
/**
270+
* Provide validation function for the richText field. This function is run the same way
271+
* as other field validation functions.
272+
*/
254273
validate: Validate<
255274
Value,
256275
Value,
@@ -264,6 +283,10 @@ export type RichTextAdapter<
264283
AdapterProps = any,
265284
ExtraFieldProperties = any,
266285
> = {
286+
/**
287+
* Component that will be displayed in the list view. Can be typed as
288+
* `DefaultCellComponentProps` or `DefaultServerCellComponentProps`.
289+
*/
267290
CellComponent: PayloadComponent<never>
268291
/**
269292
* Component that will be displayed in the version diff view.
@@ -273,6 +296,9 @@ export type RichTextAdapter<
273296
FieldDiffServerProps<RichTextField, RichTextFieldClient>,
274297
FieldDiffClientProps<RichTextFieldClient>
275298
>
299+
/**
300+
* Component that will be displayed in the edit view.
301+
*/
276302
FieldComponent: PayloadComponent<RichTextFieldServerProps, RichTextFieldClientProps>
277303
} & RichTextAdapterBase<Value, AdapterProps, ExtraFieldProperties>
278304

@@ -287,7 +313,8 @@ export type RichTextAdapterProvider<
287313
}: {
288314
config: SanitizedConfig
289315
/**
290-
* Whether or not this is the root richText editor, defined in the payload.config.ts.
316+
* Whether or not this is the root richText editor, defined in the top-level `editor` property
317+
* of the Payload Config.
291318
*
292319
* @default false
293320
*/

0 commit comments

Comments
 (0)