Skip to content

Commit d6e21ad

Browse files
authored
docs: shorten line length in code snippet comments to avoid horizontal scrolling (#13217)
prettier doesn't seem to cover that, and horizontal scrolling in the browser is even more annoying than in the IDE. Regex used in the search engine: `^[ \t]*\* `
1 parent d7a3faa commit d6e21ad

File tree

4 files changed

+95
-43
lines changed

4 files changed

+95
-43
lines changed

docs/plugins/multi-tenant.mdx

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ The plugin accepts an object with the following properties:
5454
```ts
5555
type MultiTenantPluginConfig<ConfigTypes = unknown> = {
5656
/**
57-
* After a tenant is deleted, the plugin will attempt to clean up related documents
57+
* After a tenant is deleted, the plugin will attempt
58+
* to clean up related documents
5859
* - removing documents with the tenant ID
5960
* - removing the tenant from users
6061
*
@@ -67,19 +68,22 @@ type MultiTenantPluginConfig<ConfigTypes = unknown> = {
6768
collections: {
6869
[key in CollectionSlug]?: {
6970
/**
70-
* Set to `true` if you want the collection to behave as a global
71+
* Set to `true` if you want the collection to
72+
* behave as a global
7173
*
7274
* @default false
7375
*/
7476
isGlobal?: boolean
7577
/**
76-
* Set to `false` if you want to manually apply the baseListFilter
78+
* Set to `false` if you want to manually apply
79+
* the baseListFilter
7780
*
7881
* @default true
7982
*/
8083
useBaseListFilter?: boolean
8184
/**
82-
* Set to `false` if you want to handle collection access manually without the multi-tenant constraints applied
85+
* Set to `false` if you want to handle collection access
86+
* manually without the multi-tenant constraints applied
8387
*
8488
* @default true
8589
*/
@@ -88,7 +92,8 @@ type MultiTenantPluginConfig<ConfigTypes = unknown> = {
8892
}
8993
/**
9094
* Enables debug mode
91-
* - Makes the tenant field visible in the admin UI within applicable collections
95+
* - Makes the tenant field visible in the
96+
* admin UI within applicable collections
9297
*
9398
* @default false
9499
*/
@@ -100,22 +105,27 @@ type MultiTenantPluginConfig<ConfigTypes = unknown> = {
100105
*/
101106
enabled?: boolean
102107
/**
103-
* Field configuration for the field added to all tenant enabled collections
108+
* Field configuration for the field added
109+
* to all tenant enabled collections
104110
*/
105111
tenantField?: {
106112
access?: RelationshipField['access']
107113
/**
108-
* The name of the field added to all tenant enabled collections
114+
* The name of the field added to all tenant
115+
* enabled collections
109116
*
110117
* @default 'tenant'
111118
*/
112119
name?: string
113120
}
114121
/**
115-
* Field configuration for the field added to the users collection
122+
* Field configuration for the field added
123+
* to the users collection
116124
*
117-
* If `includeDefaultField` is `false`, you must include the field on your users collection manually
118-
* This is useful if you want to customize the field or place the field in a specific location
125+
* If `includeDefaultField` is `false`, you must
126+
* include the field on your users collection manually
127+
* This is useful if you want to customize the field
128+
* or place the field in a specific location
119129
*/
120130
tenantsArrayField?:
121131
| {
@@ -136,7 +146,8 @@ type MultiTenantPluginConfig<ConfigTypes = unknown> = {
136146
*/
137147
arrayTenantFieldName?: string
138148
/**
139-
* When `includeDefaultField` is `true`, the field will be added to the users collection automatically
149+
* When `includeDefaultField` is `true`, the field will
150+
* be added to the users collection automatically
140151
*/
141152
includeDefaultField?: true
142153
/**
@@ -153,7 +164,8 @@ type MultiTenantPluginConfig<ConfigTypes = unknown> = {
153164
arrayFieldName?: string
154165
arrayTenantFieldName?: string
155166
/**
156-
* When `includeDefaultField` is `false`, you must include the field on your users collection manually
167+
* When `includeDefaultField` is `false`, you must
168+
* include the field on your users collection manually
157169
*/
158170
includeDefaultField?: false
159171
rowFields?: never
@@ -162,7 +174,8 @@ type MultiTenantPluginConfig<ConfigTypes = unknown> = {
162174
/**
163175
* Customize tenant selector label
164176
*
165-
* Either a string or an object where the keys are i18n codes and the values are the string labels
177+
* Either a string or an object where the keys are i18n
178+
* codes and the values are the string labels
166179
*/
167180
tenantSelectorLabel?:
168181
| Partial<{
@@ -176,23 +189,27 @@ type MultiTenantPluginConfig<ConfigTypes = unknown> = {
176189
*/
177190
tenantsSlug?: string
178191
/**
179-
* Function that determines if a user has access to _all_ tenants
192+
* Function that determines if a user has access
193+
* to _all_ tenants
180194
*
181195
* Useful for super-admin type users
182196
*/
183197
userHasAccessToAllTenants?: (
184198
user: ConfigTypes extends { user: unknown } ? ConfigTypes['user'] : User,
185199
) => boolean
186200
/**
187-
* Opt out of adding access constraints to the tenants collection
201+
* Opt out of adding access constraints to
202+
* the tenants collection
188203
*/
189204
useTenantsCollectionAccess?: boolean
190205
/**
191-
* Opt out including the baseListFilter to filter tenants by selected tenant
206+
* Opt out including the baseListFilter to filter
207+
* tenants by selected tenant
192208
*/
193209
useTenantsListFilter?: boolean
194210
/**
195-
* Opt out including the baseListFilter to filter users by selected tenant
211+
* Opt out including the baseListFilter to filter
212+
* users by selected tenant
196213
*/
197214
useUsersTenantFilter?: boolean
198215
}
@@ -327,14 +344,16 @@ type ContextType = {
327344
/**
328345
* Prevents a refresh when the tenant is changed
329346
*
330-
* If not switching tenants while viewing a "global", set to true
347+
* If not switching tenants while viewing a "global",
348+
* set to true
331349
*/
332350
setPreventRefreshOnChange: React.Dispatch<React.SetStateAction<boolean>>
333351
/**
334352
* Sets the selected tenant ID
335353
*
336354
* @param args.id - The ID of the tenant to select
337-
* @param args.refresh - Whether to refresh the page after changing the tenant
355+
* @param args.refresh - Whether to refresh the page
356+
* after changing the tenant
338357
*/
339358
setTenant: (args: {
340359
id: number | string | undefined

docs/rich-text/custom-features.mdx

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -474,11 +474,15 @@ const MyNodeComponent = React.lazy(() =>
474474
)
475475

476476
/**
477-
* This node is a DecoratorNode. DecoratorNodes allow you to render React components in the editor.
477+
* This node is a DecoratorNode. DecoratorNodes allow
478+
* you to render React components in the editor.
478479
*
479-
* They need both createDom and decorate functions. createDom => outside of the html. decorate => React Component inside of the html.
480+
* They need both createDom and decorate functions.
481+
* createDom => outside of the html.
482+
* decorate => React Component inside of the html.
480483
*
481-
* If we used DecoratorBlockNode instead, we would only need a decorate method
484+
* If we used DecoratorBlockNode instead,
485+
* we would only need a decorate method
482486
*/
483487
export class MyNode extends DecoratorNode<React.ReactElement> {
484488
static clone(node: MyNode): MyNode {
@@ -490,9 +494,11 @@ export class MyNode extends DecoratorNode<React.ReactElement> {
490494
}
491495

492496
/**
493-
* Defines what happens if you copy a div element from another page and paste it into the lexical editor
497+
* Defines what happens if you copy a div element
498+
* from another page and paste it into the lexical editor
494499
*
495-
* This also determines the behavior of lexical's internal HTML -> Lexical converter
500+
* This also determines the behavior of lexical's
501+
* internal HTML -> Lexical converter
496502
*/
497503
static importDOM(): DOMConversionMap | null {
498504
return {
@@ -504,37 +510,47 @@ export class MyNode extends DecoratorNode<React.ReactElement> {
504510
}
505511

506512
/**
507-
* The data for this node is stored serialized as JSON. This is the "load function" of that node: it takes the saved data and converts it into a node.
513+
* The data for this node is stored serialized as JSON.
514+
* This is the "load function" of that node: it takes
515+
* the saved data and converts it into a node.
508516
*/
509517
static importJSON(serializedNode: SerializedMyNode): MyNode {
510518
return $createMyNode()
511519
}
512520

513521
/**
514-
* Determines how the hr element is rendered in the lexical editor. This is only the "initial" / "outer" HTML element.
522+
* Determines how the hr element is rendered in the
523+
* lexical editor. This is only the "initial" / "outer"
524+
* HTML element.
515525
*/
516526
createDOM(config: EditorConfig): HTMLElement {
517527
const element = document.createElement('div')
518528
return element
519529
}
520530

521531
/**
522-
* Allows you to render a React component within whatever createDOM returns.
532+
* Allows you to render a React component within
533+
* whatever createDOM returns.
523534
*/
524535
decorate(): React.ReactElement {
525536
return <MyNodeComponent nodeKey={this.__key} />
526537
}
527538

528539
/**
529-
* Opposite of importDOM, this function defines what happens when you copy a div element from the lexical editor and paste it into another page.
540+
* Opposite of importDOM, this function defines what
541+
* happens when you copy a div element from the lexical
542+
* editor and paste it into another page.
530543
*
531-
* This also determines the behavior of lexical's internal Lexical -> HTML converter
544+
* This also determines the behavior of lexical's
545+
* internal Lexical -> HTML converter
532546
*/
533547
exportDOM(): DOMExportOutput {
534548
return { element: document.createElement('div') }
535549
}
536550
/**
537-
* Opposite of importJSON. This determines what data is saved in the database / in the lexical editor state.
551+
* Opposite of importJSON. This determines what
552+
* data is saved in the database / in the lexical
553+
* editor state.
538554
*/
539555
exportJSON(): SerializedLexicalNode {
540556
return {
@@ -556,18 +572,23 @@ export class MyNode extends DecoratorNode<React.ReactElement> {
556572
}
557573
}
558574

559-
// This is used in the importDOM method. Totally optional if you do not want your node to be created automatically when copy & pasting certain dom elements
560-
// into your editor.
575+
// This is used in the importDOM method. Totally optional
576+
// if you do not want your node to be created automatically
577+
// when copy & pasting certain dom elements into your editor.
561578
function $yourConversionMethod(): DOMConversionOutput {
562579
return { node: $createMyNode() }
563580
}
564581

565-
// This is a utility method to create a new MyNode. Utility methods prefixed with $ make it explicit that this should only be used within lexical
582+
// This is a utility method to create a new MyNode.
583+
// Utility methods prefixed with $ make it explicit
584+
// that this should only be used within lexical
566585
export function $createMyNode(): MyNode {
567586
return $applyNodeReplacement(new MyNode())
568587
}
569588

570-
// This is just a utility method you can use to check if a node is a MyNode. This also ensures correct typing.
589+
// This is just a utility method you can use
590+
// to check if a node is a MyNode. This also
591+
// ensures correct typing.
571592
export function $isMyNode(
572593
node: LexicalNode | null | undefined,
573594
): node is MyNode {
@@ -626,10 +647,12 @@ export const INSERT_MYNODE_COMMAND: LexicalCommand<void> = createCommand(
626647
)
627648

628649
/**
629-
* Plugin which registers a lexical command to insert a new MyNode into the editor
650+
* Plugin which registers a lexical command to
651+
* insert a new MyNode into the editor
630652
*/
631653
export const MyNodePlugin: PluginComponent = () => {
632-
// The useLexicalComposerContext hook can be used to access the lexical editor instance
654+
// The useLexicalComposerContext hook can be used
655+
// to access the lexical editor instance
633656
const [editor] = useLexicalComposerContext()
634657

635658
useEffect(() => {

docs/rich-text/official-features.mdx

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,15 @@ HeadingFeature({
124124
```ts
125125
type IndentFeatureProps = {
126126
/**
127-
* The nodes that should not be indented. "type" property of the nodes you don't want to be indented.
128-
* These can be: "paragraph", "heading", "listitem", "quote" or other indentable nodes if they exist.
127+
* The nodes that should not be indented. "type"
128+
* property of the nodes you don't want to be indented.
129+
* These can be: "paragraph", "heading", "listitem",
130+
* "quote" or other indentable nodes if they exist.
129131
*/
130132
disabledNodes?: string[]
131133
/**
132-
* If true, pressing Tab in the middle of a block such as a paragraph or heading will not insert a tabNode.
134+
* If true, pressing Tab in the middle of a block such
135+
* as a paragraph or heading will not insert a tabNode.
133136
* Instead, Tab will only be used for block-level indentation.
134137
* @default false
135138
*/
@@ -180,7 +183,8 @@ type LinkFeatureServerProps = {
180183
*/
181184
disableAutoLinks?: 'creationOnly' | true
182185
/**
183-
* A function or array defining additional fields for the link feature.
186+
* A function or array defining additional
187+
* fields for the link feature.
184188
* These will be displayed in the link editor drawer.
185189
*/
186190
fields?:
@@ -235,7 +239,9 @@ LinkFeature({
235239
```ts
236240
type RelationshipFeatureProps = {
237241
/**
238-
* Sets a maximum population depth for this relationship, regardless of the remaining depth when the respective field is reached.
242+
* Sets a maximum population depth for this relationship,
243+
* regardless of the remaining depth when the respective
244+
* field is reached.
239245
*/
240246
maxDepth?: number
241247
} & ExclusiveRelationshipFeatureProps
@@ -274,7 +280,10 @@ type UploadFeatureProps = {
274280
}
275281
}
276282
/**
277-
* Sets a maximum population depth for this upload (not the fields for this upload), regardless of the remaining depth when the respective field is reached.
283+
* Sets a maximum population depth for this upload
284+
* (not the fields for this upload), regardless of
285+
* the remaining depth when the respective field is
286+
* reached.
278287
*/
279288
maxDepth?: number
280289
}

docs/upload/storage-adapters.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,8 @@ Reference any of the existing storage adapters for guidance on how this should b
292292
```ts
293293
export interface GeneratedAdapter {
294294
/**
295-
* Additional fields to be injected into the base collection and image sizes
295+
* Additional fields to be injected into the base
296+
* collection and image sizes
296297
*/
297298
fields?: Field[]
298299
/**

0 commit comments

Comments
 (0)