Remove element type for richTexy

default discord avatar
akacronos
7 months 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?

  • discord user avatar
    jesschow
    Payload Team
    7 months ago

    Hi @akacronos, 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
    akacronos
    7 months ago

    Oh, thanks!

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.