Previously, the lexical link drawer did not display any fields if the `create` permission was false, even though the `update` permission was true. The issue was a faulty permission check in `RenderFields` that did not check the top-level permission operation keys for truthiness. It only checked if the `permissions` variable itself was `true`, or if the sub-fields had `create` / `update` permissions set to `true`.
30 lines
608 B
TypeScript
30 lines
608 B
TypeScript
import type { CollectionConfig } from 'payload'
|
|
|
|
import { defaultEditorFeatures, lexicalEditor } from '@payloadcms/richtext-lexical'
|
|
|
|
import { lexicalAccessControlSlug } from '../../slugs.js'
|
|
|
|
export const LexicalAccessControl: CollectionConfig = {
|
|
slug: lexicalAccessControlSlug,
|
|
access: {
|
|
read: () => true,
|
|
create: () => false,
|
|
},
|
|
admin: {
|
|
useAsTitle: 'title',
|
|
},
|
|
fields: [
|
|
{
|
|
name: 'title',
|
|
type: 'text',
|
|
},
|
|
{
|
|
name: 'richText',
|
|
type: 'richText',
|
|
editor: lexicalEditor({
|
|
features: [...defaultEditorFeatures],
|
|
}),
|
|
},
|
|
],
|
|
}
|