Issue:
Id attribute of Div tag is stripped in Rich text component. How do we handled this. Any help regarding this appreciated?
Solution 1 (before CQ5.6):
Setting property idAttribMode (on htmlRules -> serializer -> config) to "keep" should prevent removing the id attributes
Make:
1) Under /apps/<yourApplication>/<yourComponent>/dialog/items create htmlRules/serializer/config nodes of type nt:unstructured. So, will end up with /apps/<yourApplication>/<yourComponent>/dialog/items/htmlRules/serializer/config.
2) Under "config" node create idAttribMode property and set it to "keep".
It will be like:
<htmlRules jcr:primaryType="nt:unstructured"> . . . <serializer jcr:primaryType="nt:unstructured"> <config jcr:primaryType="nt:unstructured" idAttribMode="keep"/> </serializer> . . . </htmlRules> |
Solution 2 (from CQ5.6):
Create a folder structure similar to "/libs/cq/ui/rte/core/HtmlSerializer.js" in apps as "/apps/cq/ui/rte/core/HtmlSerializer.js". Make sure that the folder structure and node types are as same as in libs. Then set "idAttribMode" to "keep" in "_init" function of HtmlSerializer.js. It will work.
Solution 3:
If 2 above solutions don't work, you should use "htmleditor" instead of "richtext".
Ref: http://blogs.adobe.com/contentmanagement/tag/richtext/