Files
payload/test/_community/collections/Posts/index.ts
Alessio Gravili d9bb51fdc7 feat(richtext-lexical)!: initialize lexical during sanitization (#6119)
BREAKING:

- sanitizeFields is now an async function
- the richText adapters now return a function instead of returning the adapter directly
2024-04-30 15:09:32 -04:00

61 lines
1.2 KiB
TypeScript

import type { CollectionConfig } from 'payload/types'
import { BlocksFeature, lexicalEditor } from '@payloadcms/richtext-lexical'
export const postsSlug = 'posts'
export const PostsCollection: CollectionConfig = {
slug: postsSlug,
admin: {
useAsTitle: 'text',
},
fields: [
{
name: 'text',
type: 'text',
},
{
name: 'richText',
type: 'richText',
},
{
name: 'richText2',
type: 'richText',
editor: lexicalEditor({
features: ({ defaultFeatures }) => [
...defaultFeatures,
BlocksFeature({
blocks: [
{
slug: 'testblock',
fields: [
{
name: 'testfield',
type: 'text',
},
],
},
],
}),
],
}),
},
// {
// type: 'row',
// fields: [],
// },
// {
// name: 'associatedMedia',
// type: 'upload',
// access: {
// create: () => true,
// update: () => false,
// },
// relationTo: mediaSlug,
// },
],
versions: {
drafts: true,
},
}