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
This commit is contained in:
Alessio Gravili
2024-04-30 15:09:32 -04:00
committed by GitHub
parent 9a636a3cfb
commit d9bb51fdc7
44 changed files with 829 additions and 795 deletions

View File

@@ -2,16 +2,19 @@ import { SanitizedConfig, sanitizeConfig } from 'payload/config'
import { Config } from 'payload/config'
import { getLocalizedSortProperty } from './getLocalizedSortProperty.js'
const config = sanitizeConfig({
localization: {
locales: ['en', 'es'],
defaultLocale: 'en',
fallback: true,
},
} as Config) as SanitizedConfig
let config: SanitizedConfig
describe('get localized sort property', () => {
it('passes through a non-localized sort property', () => {
beforeAll(async () => {
config = (await sanitizeConfig({
localization: {
locales: ['en', 'es'],
defaultLocale: 'en',
fallback: true,
},
} as Config)) as SanitizedConfig
})
it('passes through a non-localized sort property', async () => {
const result = getLocalizedSortProperty({
segments: ['title'],
config,