Skip to main content
trench999
Level 4
October 16, 2015
Solved

RTE paraformat formats = add class to tag

  • October 16, 2015
  • 6 replies
  • 4642 views

We are need to create paragraph style using and H1 tag with a class.  Under the paraformat/formats node we have a h1 node with property tag = "h1".  How to we append a class on the H1?

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 PaulMcMahon

The paraformat doesn't allow you to set a class name on the tag. The RTE has a second pluging - Styles which allows you specify a class name to applied to text, however it does so by wrapping the text in a <span> tag. See http://docs.adobe.com/docs/en/aem/6-0/administer/operations/page-authoring/rich-text-editor.html#Styles (Text) for details. 

6 replies

Community Advisor
October 16, 2015

Hi Scott,

Can you please elaborate this? we have classes in clientlibs, how do I add class to have this functionality create a tag like this.

<h1 class="h1class> ... </h1>

Here is what I have for dialog.xml, how 

<paraformat

                            jcr:primaryType="nt:unstructured"

                            features="*">

                            <formats jcr:primaryType="cq:WidgetCollection">

                                 <p jcr:primaryType="nt:unstructured" description="Paragraph" tag="p" />

                                                 <h1 jcr:primaryType="nt:unstructured" description="Heading 1"tag="h1" />

       

                            </formats>

                        </paraformat>

PaulMcMahonAccepted solution
Level 8
October 16, 2015

The paraformat doesn't allow you to set a class name on the tag. The RTE has a second pluging - Styles which allows you specify a class name to applied to text, however it does so by wrapping the text in a <span> tag. See http://docs.adobe.com/docs/en/aem/6-0/administer/operations/page-authoring/rich-text-editor.html#Styles (Text) for details. 

smacdonald2008
Level 10
October 16, 2015

Most people place style values like this in CSS files and place the CSS files in clientlibs. 

trench999
trench999Author
Level 4
October 16, 2015

I want to bump this again.  The only answer I've seen is use CSS.  That is not really acceptable.  Surely we can set the width of these fields.

trench999
trench999Author
Level 4
October 16, 2015

Anyone know before I escalate to Day Care?  This simple thing is totally undocumented.

Tyler_Maynard
Level 4
July 23, 2018

This has been rough - especially when converting classic RTE plugins to Touch UI RTEs.

Companies have spent a lot of time creating customized RTE functionality and the ability to not quickly convert say, 3 types of blockquotes added to the previous styles in Classic, but converting them to Touch means I have to recreate the entire styles as a span and then move the styles.

It seems that being able to define a Block Level element and a class(es) along with it would be straight forward and standard functionality to any RTE.