# Hide buttons in the editor?

There should be an option to hide the buttons in the editor - if you know your shortcuts this might give you valuable space - especially in the browser on a notebook screen.

I got this idea from @schmidhauser who posted it on github.

As far as I see this does not exist yet? If not, maybe this is interesting for @hengiesel?

2 Likes

@kleinerpirat’s CSS Injector addon will let you hide the buttons, though not so conveniently as with a shortcut. You can even target the specific buttons whose shortcuts you have learnt and leave the rest.

You’ll probably need the WebView inspector addon to get the css targetting data.

In the new Editor code, the shortcuts are created along with the buttons, so not rendering the toolbar at all would also mean no shortcuts.

Maybe something more feasible would be to make the toolbar collapsible?

2 Likes

Couldn’t we theoretically hide the button div in the DOM, while retaining the Svelte component (and thus the shortcut)?

1 Like

I just wrote a simplistic add-on that allows you to hide anything in the editor (that isn’t inside a shadow-DOM): Hide editor elements (by id, class, CSS selector) - AnkiWeb

(By default, it hides the inline- and blockFormatting button groups. Haven’t tested on prior versions, only dev build.)

4 Likes

Can you tell me please how to configure it to hide three list buttons and attach pictures and record audio buttons?

## Config:

{
"classes": [],
"ids": [
"blockFormatting"
],
"selectors": [
"[title^='Record audio']",
"[title^='Attach pictures/audio/video']"
]
}


I just updated the add-on for 2.1.50+.

2 Likes

Thank you very much for update.
I forgot to ask for Latex / Mathjax group. Please can you help?

This makes the config a bit simpler, because all of them are under the button group #template:

{
"classes": [],
"ids": [
"blockFormatting",
"template"
],
"selectors": []
}

1 Like

Adding "template" also hid </> icon that allows to edit html. I’d like to keep it.

Sounds like you’re using an Anki version below 2.1.45. You can use the same approach as

and add the Latex / MathJax button under “selectors” using the tooltip that’s displayed on hover.

For further info, use CSS Selectors Reference.

Now I have it like this:


{
"classes": [],
"ids": [
"blockFormatting"
],
"selectors": [
"[title^='Record audio']",
"[title^='Attach pictures/audio/video']",
"[title^='Latex / MathJax']"
]
}


and I am on Anki Version ⁨2.1.49 (dc80804a)⁩, Python 3.8.1 Qt 5.15.1 PyQt 5.15.1.
And it shows both Fx and </> icons. Adding "template" hides both icons.
I am forced to use this version because of other add-ons.
There is only tooltip for </> but no for Latex / MathJax.

Sorry, I didn’t remember correctly when that HTML editor button was removed.
This selector will hide the buttons you want to hide:

#template > .btn-group > :not(#cloze):nth-child(-n+4)

Explanation: nth-child(-n+4) selects the first four buttons, but we don’t want to hide the cloze button which is in-between the recording- and MathJax buttons, so we use :not(#cloze) to exclude it from the list.

Please note that the selector might have to be adjusted if an add-on inserts its button into the #template group.