fix(richtext-lexical): defaultValue property didn't fit into field schema
This commit is contained in:
@@ -353,7 +353,7 @@ export const blocks = baseField.keys({
|
||||
export const richText = baseField.keys({
|
||||
name: joi.string().required(),
|
||||
admin: baseAdminFields.default(),
|
||||
defaultValue: joi.alternatives().try(joi.array().items(joi.object()), joi.func()),
|
||||
defaultValue: joi.alternatives().try(joi.array().items(joi.object()), joi.func(), joi.object()),
|
||||
editor: joi
|
||||
.object()
|
||||
.keys({
|
||||
|
||||
@@ -75,6 +75,33 @@ const RichTextFields: CollectionConfig = {
|
||||
{
|
||||
name: 'richTextLexical',
|
||||
type: 'richText',
|
||||
admin: {
|
||||
description: 'This rich text field uses the lexical editor.',
|
||||
},
|
||||
defaultValue: {
|
||||
root: {
|
||||
children: [
|
||||
{
|
||||
children: [
|
||||
{
|
||||
text: 'This is a paragraph.',
|
||||
type: 'text',
|
||||
},
|
||||
],
|
||||
direction: null,
|
||||
format: '',
|
||||
indent: 0,
|
||||
type: 'paragraph',
|
||||
version: 1,
|
||||
},
|
||||
],
|
||||
direction: null,
|
||||
format: '',
|
||||
indent: 0,
|
||||
type: 'root',
|
||||
version: 1,
|
||||
},
|
||||
},
|
||||
editor: lexicalEditor({
|
||||
features: ({ defaultFeatures }) => [...defaultFeatures, TreeviewFeature()],
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user