There are two ways to add custom styles to the TinyMce Style Formats dropdown in Umbraco.
The first way that you've found is to associate a stylesheet with the Rich Text Editor, and this creates comments in the CSS file that are used to define the dropdown options - but lacks the ability to group styles into menus.
The second way, is via custom TinyMce configuration, Umbraco allows you to pass the standard config options of TinyMce into Umbraco's implementation via a 'CustomConfig' setting, and TinyMce allows you to group options on the dropdown, using a json format.
The old Umbracov7/V8 documentation has a good description of how this works and what the configuration should look like:
However in V10 the tinymce is configured in a different way via appsettings.json - there is the same example as V7/V8 documentation, but it's not quite so clear, what is going on... eg the JSON has to be all on one line!
With this second approach the downside is it applies to all Rich Text Editor instance with the style format dropdown available, and you might want to have different dropdowns for different Rich Text Editors in your site.
The upside is the styles are contextual, so if you have a style rule to make an anchor link look like a button, those styles are only applicable to an anchor link...
How to create submenus for RTE Frormat styles.
I have a lot of styles in the css file. How I can group by name this styles like in the picture?
I have css file like this:
How to create 2 submenus "Sizes" and "Weights"
Hi Vyacheslav
There are two ways to add custom styles to the TinyMce Style Formats dropdown in Umbraco.
The first way that you've found is to associate a stylesheet with the Rich Text Editor, and this creates comments in the CSS file that are used to define the dropdown options - but lacks the ability to group styles into menus.
The second way, is via custom TinyMce configuration, Umbraco allows you to pass the standard config options of TinyMce into Umbraco's implementation via a 'CustomConfig' setting, and TinyMce allows you to group options on the dropdown, using a json format.
The old Umbracov7/V8 documentation has a good description of how this works and what the configuration should look like:
https://our.umbraco.com/Documentation/Reference/Configuration-for-Umbraco-7-and-8/tinyMceConfig/#style-formats
However in V10 the tinymce is configured in a different way via appsettings.json - there is the same example as V7/V8 documentation, but it's not quite so clear, what is going on... eg the JSON has to be all on one line!
https://docs.umbraco.com/umbraco-cms/reference/configuration/richtexteditorsettings#examples
With this second approach the downside is it applies to all Rich Text Editor instance with the style format dropdown available, and you might want to have different dropdowns for different Rich Text Editors in your site.
The upside is the styles are contextual, so if you have a style rule to make an anchor link look like a button, those styles are only applicable to an anchor link...
regards
Marc
Thank you for your answer!
Indeed, I should use custom config for this.
I added
but there is no my styles anyway =(
Could you please review my config? May be I shoud change something in the default config tag?
is working on a reply...