Lexical tests comprise almost half of the collections in the fields suite, and are starting to become complex to manage. They are sometimes related to other auxiliary collections, so refactoring one test sometimes breaks another, seemingly unrelated one. In addition, the fields suite is very large, taking a long time to compile. This will make it faster. Some ideas for future refactorings: - 3 main collections: defaultFeatures, fully featured, and legacy. Legacy is the current one that has multiple editors and could later be migrated to the first two. - Avoid collections with more than 1 editor. - Create reseed buttons to restore the editor to certain states, to avoid a proliferation of collections and documents. - Reduce the complexity of the three auxiliary collections (text, array, upload), which are rarely or never used and have many fields designed for tests in the fields suite.
39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
import type { CollectionConfig } from 'payload'
|
|
|
|
import { lexicalEditor, UploadFeature } from '@payloadcms/richtext-lexical'
|
|
|
|
/**
|
|
* Do not change this specific CollectionConfig. Simply having this config in payload used to cause the admin panel to hang.
|
|
* Thus, simply having this config in the test suite is enough to test the bug fix and prevent regressions. In case of regression,
|
|
* the entire admin panel will hang again and all tests will fail.
|
|
*/
|
|
export const LexicalObjectReferenceBugCollection: CollectionConfig = {
|
|
slug: 'lexicalObjectReferenceBug',
|
|
fields: [
|
|
{
|
|
name: 'lexicalDefault',
|
|
type: 'richText',
|
|
},
|
|
{
|
|
name: 'lexicalEditor',
|
|
type: 'richText',
|
|
editor: lexicalEditor({
|
|
features: [
|
|
UploadFeature({
|
|
collections: {
|
|
media: {
|
|
fields: [
|
|
{
|
|
name: 'caption',
|
|
type: 'richText',
|
|
},
|
|
],
|
|
},
|
|
},
|
|
}),
|
|
],
|
|
}),
|
|
},
|
|
],
|
|
}
|