1

In the past I've managed to remove a few formatting buttons from Redactor but am having trouble with the new version.

The goal is to remove 'quote', 'code' and 'heading1' from the formatting-dropdown. (see attached).

I need to know how to remove the highlighted items

So far I have tried various ways of inserting this from the documentation:

['p', 'h2', 'h3', 'h4', 'h5']

This is the only attempt which hasn't resulted in a syntax error, but which has resulted in the formatting button disappearing completely!

  "buttons": [
    "html",
    "formatting: ['p', 'h2', 'h3', 'h4', 'h5']",
    "bold",
    "italic",
    "unorderedlist",
    "orderedlist",
    "link",
    "image",
    "video"
  ],
  "plugins": [
    "fullscreen",
    "video"
  ],
  "linkNewTab": true,
  "toolbarFixed": true
}

Please could you spoon feed me the json as I cannot seem to find the answer anywhere. Thanks in advance for your help!

2

Inside the buttons array, you should only mention formatting.

The actual styles you want to put inside an array with key "formatting".

{
  "buttons": [
    "html",
    "formatting",
    "bold",
    "italic",
    "unorderedlist",
    "orderedlist",
    "link",
    "image",
    "video"
  ],
  "formatting": ["p", "h2", "h3", "h4", "h5"],
  "plugins": [
    "fullscreen",
    "video"
  ],
  "linkNewTab": true,
  "toolbarFixed": true
}

Reading a bit further in the docs, you could also remove the styles you don't want, instead of stating the ones you do want: formattingHide: ["blockquote", "pre", "h1"]

1
  • Bro, I love you! – Matt P Nov 11 '20 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.