Expand my Community achievements bar.

SOLVED

RichText <span> tag closing prematurely

Avatar

Level 1

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

1 Accepted Solution

Avatar

Correct answer by
Level 9

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

View solution in original post

3 Replies

Avatar

Level 1

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

Avatar

Correct answer by
Level 9

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