[3.0] Lexical Block
Link to reproduction
No response
Describe the Bug
According to the https://payloadcms.com/docs/rich-text/lexical#integrating-new-features, when testing taking the documentation code for integrating new features like adding block into the lexical editor, there are 2 typescript issues:
export default buildConfig({
editor: lexicalEditor({
features: ({ defaultFeatures }) => [
...defaultFeatures,
LinkFeature({
// Example showing how to customize the built-in fields
// of the Link feature
fields: [
{
name: 'rel',
label: 'Rel Attribute',
type: 'select',
hasMany: true,
options: ['noopener', 'noreferrer', 'nofollow'],
admin: {
description:
'The rel attribute defines the relationship between a linked resource and the current document. This is a custom link field.',
},
},
],
}),
UploadFeature({
collections: {
uploads: {
// Example showing how to customize the built-in fields
// of the Upload feature
fields: [
{
name: 'caption',
type: 'richText',
editor: lexicalEditor(),
},
],
},
},
}),
// This is incredibly powerful. You can re-use your Payload blocks
// directly in the Lexical editor as follows:
BlocksFeature({
blocks: [
developmentPlan as LexicalBlock
],
}),
]
}),
...
})
-
issue: TS2322: Type ({defaultFeatures}: { defaultFeatures: FeatureProviderServer<unknown, unknown>[]; }) => (FeatureProviderServer<unknown, unknown> | FeatureProviderServer<LinkFeatureServerProps, ExclusiveLinkCollectionsProps> | FeatureProviderServer<...> | FeatureProviderServer<...>)[] is not assignable to type (({defaultFeatures,}: { defaultFeatures: FeatureProviderServer<unknown, unknown>[]; }) => FeatureProviderServer<unknown, unknown>[]) | FeatureProviderServer<unknown, unknown>[] | undefined
-
issue: block given expect to be LexicalBlock but it is type of Block.
To Reproduce
Folow the documentation on https://payloadcms.com/docs/rich-text/lexical#integrating-new-features
Payload Version
3.0.
Adapters and Plugins
LexicalEditor