This works for me:
h4 { EditMenuTitle: Headers; ChangeElementType: true; EditMenuName: Header 4; } h5 { ChangeElementType: true; EditMenuName: Header 5; } img.align-right { EditMenuTitle: Images; ChangeElementType: true; EditMenuName: Image right; } img.align-left { ChangeElementType: true; EditMenuName: Image left; }
Text translation:
<?xml version="1.0" encoding="utf-8"?> <languages> <language name="English" id="en"> <editorstyleoptions> <headers>Headers</headers> <header_4>Header 2</header_4> <header_5>Header 3</header_5> <images>Images</images> <image_right>Image to right</image_right> <image_left>Image to left</image_left> </editorstyleoptions> </language> </languages>
Hi Empa.
first of all thank you for your answer.
I have included the "ChangeElementType: true;" property on each style inside my "Editor.css" file and now it looks something like this:
p.bold .red { EditMenuTitle: Paragraphs Styles; ChangeElementType: true; EditMenuName: Bold red paragraph; } h2.hstyle .normal { EditMenuTitle: Headding Styles; ChangeElementType: true; EditMenuName: H2 Normal; } h2.hstyle .italic { ChangeElementType: true; EditMenuName: H2 Italic; } h2.hstyle .italic .red { ChangeElementType: true; EditMenuName: H2 Italic Red; }
And the html code for the rendered view / property is this:
<p>Este es un ejemplo sobre la funcionalidad del Commerce de Episerver.</p> <p class="bold red">P bold red</p> <h2 class="hstyle normal">H2</h2> <h2 class="hstyle italic">H2 Italic</h2> <h2 class="hstyle italic red">H2 Italic Red</h2>
So I can say that your solution works for me.
But I would like to know what does "ChangeElementType: true;" mean because I want to understand correctly why I need to use it.
Best regards.
"ChangeElementType. Lets you apply a class and change the element type for text block elements (p, h1, h2, and so on)."
Hi good morning.
I'm trying to understand how to customize the TinyMCE and also how to add custom styles in the Styles drop down.
For this, I have created a new Class "ExtendedTinyMceSettings" which inherits from PropertySettings, this class customizes the TinyMCE's toolbox, well on my case this works properly. I also decorated an XHTMLString property whit this class in my StartPage model (PageType).
This is the class code for the "ExtendedTinyMCESettings.cs":
This is the class code for the "StartPage.cs":
But, my problem comes when I try to add new styles to the TinyMCE Editor. I have created to style sheets, one called Editor.css (this includes the "style definitions" for the TinyMCE styles drop down) and Site.css (this should includes the Site styles), you can see the content for those Style sheets:
Editor.css:
Stie.css:
Well when I debug the code and go to the CMS edit tab, this is what I see:
https://drive.google.com/file/d/1GKtEOD8bIDUgQ_jfJA7LN_WzHGRRXOe9/view?usp=sharing
https://drive.google.com/file/d/1aVWRK1XhmN2c5pD6ykbnKXFYspVDEw0h/view?usp=sharing
As you can see, there are the new styles in the TinyMCE Styles drop down, but no one of those styles are being applied. Only one style are been applied: p.bold .red
Doesn't matter which header style I choose, the style that the Editor applies always is p
I'm a little bit lost and I don't know what I'm doing bad.
I'm using Episerver 11.3.4.0 for this Test.
I need your help guys.
Best regards.