# Customization of the HTML editor is not possible

**URL:** <https://discourse.getcockpit.com/t/customization-of-the-html-editor-is-not-possible/2128>\
**Category:** Uncategorized\
**Created:** [October 31, 2021, 10:48am UTC](https://discourse.getcockpit.com/t/customization-of-the-html-editor-is-not-possible/2128 "2021-10-31T10:48:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarcTabaries](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/marctabaries/32/867_2.png) [@MarcTabaries](https://discourse.getcockpit.com/u/MarcTabaries)\
**Post date:** [October 31, 2021, 10:48am UTC](https://discourse.getcockpit.com/t/customization-of-the-html-editor-is-not-possible/2128/1 "2021-10-31T10:48:42Z")

</div>

Hi,

I want to customize the HTML editor in Cockpit to leave only the Bold and Italic options.

I saw in the [documentation](https://getcockpit.com/documentation/reference/fieldtypes) that this was possible.

```auto
{
    "iframe" : false,
    "mode" : "split",
    "markdown" : false,
    "enablescripts" : false,
    "height" : 500,
    "maxsplitsize" : 1000,
    "codemirror" : { /* codemirror settings */ },
    "toolbar" : ["bold", "italic", "strike", "link", "image", "blockquote", "listUl", "listOl"],
    "lblPreview" : "Preview",
    "lblCodeview" : "HTML",
    "lblMarkedview" : "Markdown"
}

```

To test it, I decided to remove the Bold button (see toolbar key). It works.

```auto
{
    "iframe" : false,
    "mode" : "split",
    "markdown" : false,
    "enablescripts" : false,
    "height" : 500,
    "maxsplitsize" : 1000,
    "codemirror" : { /* codemirror settings */ },
    "toolbar" : ["italic", "strike", "link", "image", "blockquote", "listUl", "listOl"],
    "lblPreview" : "Preview",
    "lblCodeview" : "HTML",
    "lblMarkedview" : "Markdown"
}

```

Then I tested leaving only Bold and Italic (see toolbar key)… but it doesn’t work. All the buttons remain displayed.

```auto
{
    "iframe" : false,
    "mode" : "split",
    "markdown" : false,
    "enablescripts" : false,
    "height" : 500,
    "maxsplitsize" : 1000,
    "codemirror" : { /* codemirror settings */ },
    "toolbar" : ["bold", "italic"],
    "lblPreview" : "Preview",
    "lblCodeview" : "HTML",
    "lblMarkedview" : "Markdown"
}

```

I tested again by deleting only the ListUl and ListOl (see toolbar key)… but again it doesn’t work. All the buttons remain displayed.

```auto
{
    "iframe" : false,
    "mode" : "split",
    "markdown" : false,
    "enablescripts" : false,
    "height" : 500,
    "maxsplitsize" : 1000,
    "codemirror" : { /* codemirror settings */ },
    "toolbar" : ["bold", "italic", "strike", "link", "image", "blockquote"],
    "lblPreview" : "Preview",
    "lblCodeview" : "HTML",
    "lblMarkedview" : "Markdown"
}

```

I don’t understand where the problem comes from. I know that it is possible to hide the buttons by injecting CSS into Cockpit… but if it is possible to do otherwise, I think it would be better.

Do you have an idea ?

Thanks.

---

<div class="post-metadata">

**Author:** ![abernh](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/abernh/32/859_2.png) [@abernh](https://discourse.getcockpit.com/u/abernh)\
**Post date:** [November 1, 2021, 2:19pm UTC](https://discourse.getcockpit.com/t/customization-of-the-html-editor-is-not-possible/2128/2 "2021-11-01T14:19:08Z")

</div>

I had a look into the general HTML editor initialization and could not find a reason that would explain this behavior.  
The only buttons that are always added to the field options are the “Finder” and “Assets” buttons.

To recap

- if you only remove “bold” it hides “bold”
- if you remove any other it does not adjust anything

Is this still the behavior?  
Or does removing only “bold” not change anything anymore as well?

---

<div class="post-metadata">

**Author:** ![MarcTabaries](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/marctabaries/32/867_2.png) [@MarcTabaries](https://discourse.getcockpit.com/u/MarcTabaries)\
**Post date:** [November 2, 2021, 10:26am UTC](https://discourse.getcockpit.com/t/customization-of-the-html-editor-is-not-possible/2128/3 "2021-11-02T10:26:31Z")

</div>

Here are the details of the problem :

**1/ By default, all buttons are displayed**

 ![01](https://canada1.discourse-cdn.com/flex030/uploads/getcockpit/original/1X/55d99bbab136e79620772b9ca4f975189bbbac39.png)

```auto

"toolbar": ["bold", "italic", "strike", "link", "image", "blockquote", "listUl", "listOl"],

```

**2/**

 ![02](https://canada1.discourse-cdn.com/flex030/uploads/getcockpit/original/1X/529295901107d0cd7eff08ce89a5565600c17981.png)

Button deleted : Bold  
Duplicate buttons : ListOl

```auto

"toolbar": ["italic", "strike", "link", "image", "blockquote", "listUl", "listOl"],

```

**3/**

 ![03](https://canada1.discourse-cdn.com/flex030/uploads/getcockpit/original/1X/eba15203c6f58c29d38b40a29bbda9e811e1f782.png)

Button deleted : Bold, Italic  
Duplicate buttons : ListUl, ListOl

```auto

"toolbar": ["strike", "link", "image", "blockquote", "listUl", "listOl"],

```

**4/**

 ![04](https://canada1.discourse-cdn.com/flex030/uploads/getcockpit/original/1X/4ff69554dd0ef291f79a0fd3d2afadf617a25894.png)

Button deleted : Bold, Italic, Strike  
Duplicate buttons : Blockquote, ListUl, ListOl

```auto

"toolbar": ["link", "image", "blockquote", "listUl", "listOl"],

```

**5/**

 ![05](https://canada1.discourse-cdn.com/flex030/uploads/getcockpit/original/1X/bc1bbf89d174075260e245a853b88e743e76cc9e.png)

Button deleted : Bold, Italic, Strike, Link  
Duplicate buttons : Image, Blockquote, ListUl, ListOl

```auto

"toolbar": ["image", "blockquote", "listUl", "listOl"],

```

**6/**

 ![06](https://canada1.discourse-cdn.com/flex030/uploads/getcockpit/original/1X/e7a01246610da7d62f32c687c853c1b5521d8339.png)

Button deleted : Bold, Italic, Strike, Link, Image  
Duplicate buttons : Link, Image, Blockquote, ListUl, ListOl

```auto

"toolbar": ["blockquote", "listUl", "listOl"],

```

**7/**

 ![07](https://canada1.discourse-cdn.com/flex030/uploads/getcockpit/original/1X/662395c566ea308af479f6d4676dac284c2741c5.png)

Button deleted : Bold, Italic, Strike, Link, Image, Blockquote  
Duplicate buttons : Strike, Link, Image, Blockquote, ListUl, ListOl

```auto

"toolbar": ["listUl", "listOl"],

```

**8/**

 ![08](https://canada1.discourse-cdn.com/flex030/uploads/getcockpit/original/1X/d3ccdd59973841ced408a650a28687893e9b82bd.png)

Button deleted : Bold, Italic, Strike, Link, Image, Blockquote, ListUl  
Duplicate buttons : Italic, Strike, Link, Image, Blockquote, ListUl, ListOl

```auto

"toolbar": ["listOl"],

```

**9/**

 ![09](https://canada1.discourse-cdn.com/flex030/uploads/getcockpit/original/1X/3963710818da74a5e5335e39bffe8cb8a713122c.png)

Button deleted : Bold, Italic, Strike, Link, Image, Blockquote, ListUl, ListOl  
All buttons are displayed

```auto

"toolbar": [],

```

**10/**

 ![10](https://canada1.discourse-cdn.com/flex030/uploads/getcockpit/original/1X/3963710818da74a5e5335e39bffe8cb8a713122c.png)

The only buttons I want to display : Bold, Italic  
All buttons are displayed

```auto

"toolbar": ["bold", "italic"],

```

Bye.

---

<div class="post-metadata">

**Author:** ![abernh](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/abernh/32/859_2.png) [@abernh](https://discourse.getcockpit.com/u/abernh)\
**Post date:** [November 4, 2021, 9:08pm UTC](https://discourse.getcockpit.com/t/customization-of-the-html-editor-is-not-possible/2128/4 "2021-11-04T21:08:37Z")

</div>

😆 that was very thorough. Thank you.  
And it is now even more confusing how and why this happens.  
I’ll get back to you.

---

<div class="post-metadata">

**Author:** ![SHOCKStudio](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/shockstudio/32/1005_2.png) [@SHOCKStudio](https://discourse.getcockpit.com/u/SHOCKStudio)\
**Post date:** [January 13, 2022, 11:03am UTC](https://discourse.getcockpit.com/t/customization-of-the-html-editor-is-not-possible/2128/5 "2022-01-13T11:03:53Z")

</div>

Hi, Have you found a solution to the html field problem
