RTE Dialog Source Edit - Content with HTML Tags rendered | Community
Skip to main content
Level 2
September 1, 2020
Solved

RTE Dialog Source Edit - Content with HTML Tags rendered

  • September 1, 2020
  • 2 replies
  • 5455 views

Hi All,

 

I have a component in AEM with a property that's Rich Text enabled using sling:resourceType - cq/gui/components/authoring/dialog/richtext

The component is working correctly in edit mode for Source Edit. The HTML tags render the content enter correctly.

However, as soon as I click ok and come to Edit/Preview screen - The content comes with HTML tags (like <h6>Hello, Rohan</h6>)

 

So the source edit works correctly when configuring content but the html tags do not get removed in edit/preview mode.

 

I have attached 3 screenshots showing the same. I can send the xml of the dialog if required.  

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 Vishalverma

Are you using sightly? If yes then have you used context='html' while rendering e.g. 

<div>${properties.richText @ context='html'}</div>

2 replies

Adobe Employee
September 1, 2020

What's stripping the custom tags is XSS filter, which is based on OWASP AntiSamy. You can find and customize the configuration for it under /libs/cq/xssprotection/config.xml. There you can add rules to allow your custom tag.

 

You need to allow the custom tags in RTE.

Please check http://experience-aem.blogspot.com/2015/05/aem-6-sp2-handling-custom-protocol-in-link-href-in-rte.html

Adobe Employee
September 1, 2020
If the tag is not allowed in XSS filter you have to add it.
VishalvermaAdobe EmployeeAccepted solution
Adobe Employee
September 1, 2020

Are you using sightly? If yes then have you used context='html' while rendering e.g. 

<div>${properties.richText @ context='html'}</div>
sg-aemAuthor
Level 2
September 1, 2020
Hi Vishal, Thanks for pointing this out. I had convert the component from text to rich-text without making change in sightly. Thanks for your help !