Can you change the tag a class is applied to in the style system? | Community
Skip to main content
Level 2
March 5, 2020
Solved

Can you change the tag a class is applied to in the style system?

  • March 5, 2020
  • 1 reply
  • 1550 views

When you add styles to the "allowed styles" using the style system  on a components policy, it seems that the class is added to the parent container that is generated by the component instead of the main tag that contains the content. Specifically I'm referring to the text component. You can have many different tag options, (i.e. H1 - H6, p, small) to contain the text. But when you add the allowed styles, the class is added to the parent div. I need the classes to be added directly to the tag holding the text. Is this a possible change?

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 arunpatidar

Style system adds class at component wrapper div. To add class to any HTML element(ul,li,p,h1...) you have to create a RTE plugin which can add styles directly to the specific element.

 

Please check similar plugin at https://aemlab.blogspot.com/2019/07/aem-rte-custom-plugins-1.html

1 reply

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
March 6, 2020

Style system adds class at component wrapper div. To add class to any HTML element(ul,li,p,h1...) you have to create a RTE plugin which can add styles directly to the specific element.

 

Please check similar plugin at https://aemlab.blogspot.com/2019/07/aem-rte-custom-plugins-1.html

Arun Patidar
pmueller8Author
Level 2
March 17, 2020
Thanks. I wasn't able to completely understand how this was all done but your plugin link got me a rte component that had what I needed to fulfill all I needed for this.