feat(richtext-lexical): initial working BlocksFeature

This commit is contained in:
Alessio Gravili
2024-02-29 15:46:10 -05:00
parent cccdba57fe
commit 7188cfe85a
23 changed files with 385 additions and 309 deletions

View File

@@ -1,3 +1,10 @@
import {
AlignFeature,
BlockQuoteFeature,
BlocksFeature,
LinkFeature,
lexicalEditor,
} from '@payloadcms/richtext-lexical'
import path from 'path'
import type { Config, SanitizedConfig } from '../packages/payload/src/config/types'
@@ -5,7 +12,6 @@ import type { Config, SanitizedConfig } from '../packages/payload/src/config/typ
import { mongooseAdapter } from '../packages/db-mongodb/src'
import { postgresAdapter } from '../packages/db-postgres/src'
import { buildConfig as buildPayloadConfig } from '../packages/payload/src/config/build'
import { AlignFeature, LinkFeature, lexicalEditor } from '../packages/richtext-lexical/src'
//import { slateEditor } from '../packages/richtext-slate/src'
// process.env.PAYLOAD_DATABASE = 'postgres'
@@ -73,7 +79,28 @@ export function buildConfigWithDefaults(testConfig?: Partial<Config>): Promise<S
},
}),*/
editor: lexicalEditor({
features: [LinkFeature({}), AlignFeature()],
features: [
LinkFeature({}),
AlignFeature(),
BlockQuoteFeature(),
BlocksFeature({
blocks: [
{
slug: 'myBlock',
fields: [
{
name: 'title',
type: 'text',
},
{
name: 'content',
type: 'textarea',
},
],
},
],
}),
],
}),
rateLimit: {
max: 9999999999,