Using the Style plugin in the Rich Text Editor to apply classes to block level elements. | Community
Skip to main content
September 6, 2024
Solved

Using the Style plugin in the Rich Text Editor to apply classes to block level elements.

  • September 6, 2024
  • 1 reply
  • 781 views

Hi
I am very new to Adobe Experience Manager and we're playing with the Style plugin within the Rich Text Editor in AEM.

We have successfully implemented the Style dropdown in the RTE. 
However I'd like to be able to pick a block level element and select a style from the drop down and apply it to the block level element ie img, p, h3.
It's working kind but the class="this-style" is determined to be applied to a span rather than img class="this-style".

 

I read in the Config documentation, "Stylized content is enclosed in span tags using the class attribute to refer to the CSS class. For example, <span class=monospaced>Monospaced Text Here</span>." 
ref https://experienceleague.adobe.com/en/docs/experience-manager-65/content/sites/administering/operations/configure-rich-text-editor-plug-ins#textstyles

Question for the gurus out there.
Who amongst you has successfully used the Styles plugin within the RTE to apply styles to a block level element, ie a paragraph or an image, rather than a span.
How did you do it?  What tricks, tips, insight do you have?

Thank you for your time, consideration and experience!
Regards
Croydon

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

Hi @croydon 
You may need a custom plugin to achieve this. For example I have created a plugin to apply class to any element within RTE

https://aemlab.blogspot.com/2019/07/aem-rte-custom-plugins-1.html 

1 reply

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
September 6, 2024

Hi @croydon 
You may need a custom plugin to achieve this. For example I have created a plugin to apply class to any element within RTE

https://aemlab.blogspot.com/2019/07/aem-rte-custom-plugins-1.html 

Arun Patidar