Expand my Community achievements bar.

SOLVED

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

Avatar

Level 2

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?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

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

Avatar

Level 2
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.