Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Custom Blocks not showing in Lexical RichText Editor - BlocksFeature

default discord avatar
dr.n1trogen7 months ago
3

Hi everyone,



I’ve been trying to embed custom blocks inside a richText field using the BlocksFeature, but the block options just don’t appear in the Lexical editor UI.



Here’s my field configuration:



{
  name,
  type: 'richText',
  editor: lexicalEditor({
    features: ({ defaultFeatures }) => [
      ...defaultFeatures,
      BlocksFeature({
        blocks: [
          {
            slug: 'myBlock',
            fields: [textField('someText')],
          },
        ],
      }),
    ],
  }),
}


I’ve used BlocksFeature successfully in another project with no issues, but for some reason it’s not working here — the block picker doesn’t appear at all.



Has anyone run into something similar or know what could be missing here?


I’ve double-checked that the Lexical editor and Payload versions are up to date.



Any ideas or troubleshooting steps would be appreciated! 🙏



@360823574644129795

@969226489549713438



Have you seen this one? I've been trying to get it working but didn't have any success.

  • discord user avatar
    alessiogr
    7 months ago

    Seen this sometimes, but every time I've seen this it was a random user error (e.g. forgot to push code, build didn't deploy successfully, accidentally changed wrong richtext field, accidentally overriding features...)

  • default discord avatar
    anders22927 months ago

    missing importmap update has also caused issue for me about picker not appearing

  • default discord avatar
    dr.n1trogen7 months ago
    @1063099015589273630

    You're right. Seems like

    BlocksFeatureClient

    isn't imported in import map.


    I've run

    payload generate:importmap

    but it's still not importing

    BlocksFeatureClient

    PS: I'm making changes and importing the correct field. I've checked more than once.

    :bigbrain2:

    Error: Could not find the module "[project]/node_modules/@payloadcms/richtext-lexical/dist/exports/client/index.js#BlocksFeatureClient" in the React Client Manifest. This is probably a bug in the React Server Components bundler.
        at stringify (<anonymous>) {
      digest: '764469830'
    }


    I do get this warning when I manually add imports to the

    importMap.ts

    Finally managed to fix this! I had payload root in a different directory than usual.


    Adding this to the payload config fixed the

    importMap

    generation.



     importMapFile: path.resolve(dirname,'app/(payload)/payload/admin/importMap.ts')
Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.