Rich Text Editor - Swap <i> element for <em>
Using an OSX/Chrome combination, I have specified the html rules - for use by my custom Rich Text Editor in the snippet at the foot of this question. I've also provided an overridden copy of DefaultFormatting.js and specified the elements to use as shown in the snippet at the foot of this question. While bold text is marked-up as I'd like (as strong elements), italic elements are only specified as em elements 'temporarily'.
- First time I highlight some text in the RTE and click on italic, the markup produced is
<p><em>Some text</em></p>
- If i close the RTE but then re-open it, the mark-up is changed to the unwanted
<p><i>Some text</i></p>
Is this a known issue or have I missed some additional configuration?
<htmlRules jcr:primaryType="nt:unstructured"> <docType jcr:primaryType="nt:unstructured"> <typeConfig jcr:primaryType="nt:unstructured"> <semanticMarkupMap jcr:primaryType="nt:unstructured" b="strong" em="em" i="em" strong="strong"/> </typeConfig> </docType> </htmlRules>
/** snippet from /apps/cq/ui/rte/core/commands/DefaultFormatting.js * @private */ _getTagNameForCommand: function(cmd) { var cmdLC = cmd.toLowerCase(); var tagName = null; switch (cmdLC) { case "bold": tagName = "strong"; break; case "italic": tagName = "em"; break; case "underline": tagName = "u"; break; case "subscript": tagName = "sub"; break; case "superscript": tagName = "sup"; break; } return tagName; },