TransWikia.com

Help with the latest Redactor, removing formatting options

Craft CMS Asked on January 6, 2021

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!

One Answer

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"]

Correct answer by Joorren on January 6, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP