RichText <span> tag closing prematurely | Community
Skip to main content
New Participant
October 16, 2015
Solved

RichText <span> tag closing prematurely

  • October 16, 2015
  • 3 replies
  • 1158 views

Hello,

Could someone direct me?  My RichText have properties like these:

            <tab2 jcr:primaryType="cq:Panel" title="Text">
                <items jcr:primaryType="cq:WidgetCollection">
                    <richtext jcr:primaryType="cq:Widget" fieldLabel="Rich Text" name="./text" xtype="richtext">
                        <rtePlugins jcr:primaryType="nt:unstructured">
                            <misctools jcr:primaryType="nt:unstructured" features="*"/>
                        </rtePlugins>
                        <htmlRules jcr:primaryType="nt:unstructured">
                            <serializer jcr:primaryType="nt:unstructured">
                                <config jcr:primaryType="nt:unstructured" idAttribMode="keep"/>
                            </serializer>
                        </htmlRules>
                    </richtext>
                </items>
            </tab2>

What I enter:  <p>some content</p> <span id="myId"><p>here I am</p></span>

CQ convert it to:   <p>some content</p> <p><span id="myId"> </span></p> <p>here I am</p>

I tried adding 'removeSingleParagraphContainter' property and that kept the closing </span> tag in place if there were no <p> tags above or below my <span> </span> set.  Unfortunately I need the <p> tags outside the <span> set.

When I change <span..> to <div..> it kept the closing tag in place. How do I apply the <div> feature to my <span> tag?

Thanks,

Emily

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Pawan-Gupta

Hi,

Couple of things if it helps you.

1. CQ RTE doen't recognize <span> as standard html tag

2. RTE uses <p> as a container for complete html that you enter by default until you specifically specify using removeSingleParagraphContainer or singleParagraphContainerReplacement 

3. I have never seen that RTE changes the structure of HTML entered as per your use case where it took out "here I am" from <span> tag and created a separate html tag <p> outside <span>. If you can re-validate it.

4. you can still utilize  removeSingleParagraphContainer or singleParagraphContainerReplacement to manage your HTML structure 

also refer - http://dev.day.com/docs/en/cq/current/widgets-api/index.html?class=CQ.form.RichText if it helps you.

Thanks,

Pawan

3 replies

smacdonald2008
New Participant
October 16, 2015
ENishiAuthor
New Participant
October 16, 2015

Yes, I'm aware of that page.  Unfortunately it doesn't tell users how to stop AEM 5.6.1 from re-writing content.

Pawan-Gupta
Pawan-GuptaAccepted solution
New Participant
October 16, 2015

Hi,

Couple of things if it helps you.

1. CQ RTE doen't recognize <span> as standard html tag

2. RTE uses <p> as a container for complete html that you enter by default until you specifically specify using removeSingleParagraphContainer or singleParagraphContainerReplacement 

3. I have never seen that RTE changes the structure of HTML entered as per your use case where it took out "here I am" from <span> tag and created a separate html tag <p> outside <span>. If you can re-validate it.

4. you can still utilize  removeSingleParagraphContainer or singleParagraphContainerReplacement to manage your HTML structure 

also refer - http://dev.day.com/docs/en/cq/current/widgets-api/index.html?class=CQ.form.RichText if it helps you.

Thanks,

Pawan