Context Menu - customize appearance?
Monaco version 0.11.1-- I would like to customize the appearance of the context menu. I can achieve that easily by overwriting the CSS but it doesn't seem like that the CSS is a part of public API? or is it? Is there another way to customize the context menu appearance?
There is no API to customize the look of the context menu except for writing/overwriting CSS
Thanks! Is the CSS is public? is it save to overwrite it knowing that it wouldn't change? It's not mentioned to be public - so I wonder if it could be in a process of refactoring at some point. In this case, it could make a mass in my UI if I used the classes to overwrite CSS...
Any update??
I've been overwriting CSS for a few versions and it does change so I've been operating under the assumption it is non public and will change at any moment.
I would LOVE for this to be a supported feature.
Seems like since version 0.21 it's no longer possible to style using CSS (the context menu is rendered inside a shadow root). This makes this issue more important IMO.
I would really like to change the background colour of the context menu
Any news regarding this?
It does drive me a little nuts because I can see VSCode customizing the appearance and including other features like submenus #1947 but none of these key features make it back upstream.
@smiles2424 are you still able to overwrite css or it is impossible now because of what guykr mentioned above?
It is possible by overriding services when creating the editor.
For contextMenu, you can always pass 'contextMenuService' with instance of IContextMenuService class. Take a look at the default implementation to create your own.
monaco.editor.create(document.getElementById("editor"), {}, {
'contextMenuService': {
showContextMenu: (b) => console.log(b)
}
})