BREAKING: - sanitizeFields is now an async function - the richText adapters now return a function instead of returning the adapter directly
61 lines
1.2 KiB
TypeScript
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,
|
|
},
|
|
}
|