starting to understand payload

This commit is contained in:
2025-10-10 11:51:38 -04:00
parent 343889da93
commit b8c545271a
9 changed files with 193 additions and 72 deletions

View File

@@ -1,7 +1,7 @@
// storage-adapter-import-placeholder
import { postgresAdapter } from '@payloadcms/db-postgres'
import { payloadCloudPlugin } from '@payloadcms/payload-cloud'
import { lexicalEditor } from '@payloadcms/richtext-lexical'
import { FixedToolbarFeature, HorizontalRuleFeature, lexicalEditor, UploadFeature } from '@payloadcms/richtext-lexical'
import path from 'path'
import { buildConfig } from 'payload'
import { fileURLToPath } from 'url'
@@ -9,6 +9,7 @@ import sharp from 'sharp'
import { Users } from './collections/Users'
import { Media } from './collections/Media'
import { Page } from './collections/Page'
const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename)
@@ -20,8 +21,34 @@ export default buildConfig({
baseDir: path.resolve(dirname),
},
},
collections: [Users, Media],
editor: lexicalEditor(),
collections: [Users, Media, Page],
editor: lexicalEditor({
features: ({ defaultFeatures, rootFeatures }) => [
...defaultFeatures,
FixedToolbarFeature({
applyToFocusedEditor: true
}),
HorizontalRuleFeature(),
UploadFeature({
collections: {
uploads: {
fields: [
{
name: 'caption',
type: 'text',
label: 'Caption',
},
{
name: 'alt',
type: 'text',
label: 'Alt Text',
},
]
}
}
})
]
}),
secret: process.env.PAYLOAD_SECRET || '',
typescript: {
outputFile: path.resolve(dirname, 'payload-types.ts'),