import {
  BoldFeature,
  FixedToolbarFeature,
  ItalicFeature,
  lexicalEditor,
  ParagraphFeature,
  UploadFeature,
} from '@payloadcms/richtext-lexical'

const lexicalEditorWrapper = lexicalEditor({
  features: ({ defaultFeatures }) => [
    ...defaultFeatures,
    BoldFeature(),
    ItalicFeature(),
    ParagraphFeature(),
    // FixedToolbarFeature(),

    UploadFeature({
      collections: {
        media: {
          fields: [
            {
              name: 'caption',
              type: 'richText',
              editor: lexicalEditor(),
            },
          ],
        },
      },
    }),
  ],
})

export { lexicalEditorWrapper }
