问题
The widget API suggests that you can change the default wrapping tag for the rich text editor content via the DocType object on the HtmlRules object under a rich text editor:
defaultEditBlock : String The default edit block type to use; defaults to "p" Added in CQ 5.4.
I need to change this so that I can include the content of a rich text editor field within a p tag which has a particular class (you cannot put one p tag inside another so the automatic wrapping breaks out of my predefined p tag).
Unfortunatly it would seem that this node is being ignored.
What do I need to do to remove the p tags or if not that then change them to something that would go inside a p tag?
The following is the xml for the rich text editor, the rtePlugins node seems to work correctly but not the htmlRules node.
<introText
jcr:primaryType="cq:Widget"
allowBlank="{Boolean}false"
fieldLabel="Intro text"
name="./introText"
xtype="richtext">
<htmlRules jcr:primaryType="nt:unstructured">
<docType jcr:primaryType="nt:unstructured"
defaultEditBlock="span">
</docType>
</htmlRules>
<rtePlugins jcr:primaryType="nt:unstructured">
<edit jcr:primaryType="nt:unstructured"
features="[cut,copy,paste-default,paste-plaintext]"/>
<format jcr:primaryType="nt:unstructured"
features="[]"/>
<justify jcr:primaryType="nt:unstructured"
features="[]"/>
<lists jcr:primaryType="nt:unstructured"
features="[]"/>
</rtePlugins>
</introText>
来源:https://stackoverflow.com/questions/13798280/cq5-rich-text-editor-htmlrules-doctype-node-being-ignored