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.

Remove element type for richTexy

default discord avatar
akacronos2 years ago
2

I want to remove de code button from a richtext field, i don't add it in my

admin:elements[]

is there a way to remove it?

  • default discord avatar
    jessrynkar2 years ago

    Hi

    @706208036439588934

    , what you're doing is correct however

    code

    is not an element it is a leaf. You can see which options are elements vs leaves here:

    https://payloadcms.com/docs/fields/rich-text#admin-config

    So if you add the leaves property and don't include 'code' then this option will be hidden.



        {
          name: 'content',
          type: 'richText',
          admin: {
            leaves: [
              'bold',
              'italic'
            ],
          }
        },

    For example this would just show bold and italic - or if you had an empty array here none would show.

  • default discord avatar
    akacronos2 years ago

    Oh, thanks!

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.