Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Rich Text Editor issue | RTE Removes attributes from <div> if any attribute is "id"

Avatar

Level 4

Hi,

 
I am using AEM 6.1 (actually same issue exists on older AEM too). This is related to RichText editor. 
 
Issue
In source mode when we enter below <div> :
<div id="my-key">This is test</div>
 
it removes the attributes within <div> and change it to something below:
<div>This is test</div>
 
But what we noticed was if I change the "id" attribute to "class" attribute in <div> then RTE retains the <div> without changing anything
<div class="my-key">This is test</div>
 
Just wondering if anyone of you guys had similar issue. I am using out of box RTE plugin.
 
Thanks in advance.
1 Accepted Solution

Avatar

Correct answer by
Level 8

This is to do with XSS protection that that text editor runs through.  You can find the configuration file here: /libs/cq/xssprotection/config.xml

You can overlay the file under /apps/cq/xssprotection/config.xml and modify the configuration to allow what you're putting in there.  At first glance, it looks like it validates the ID attribute with the following regex: <regexp name="htmlId" value="[a-zA-Z0-9\:\-_\.]+"/>.  You may need to configure that further, or change the ID for your element (which would likely be a better option)

View solution in original post

1 Reply

Avatar

Correct answer by
Level 8

This is to do with XSS protection that that text editor runs through.  You can find the configuration file here: /libs/cq/xssprotection/config.xml

You can overlay the file under /apps/cq/xssprotection/config.xml and modify the configuration to allow what you're putting in there.  At first glance, it looks like it validates the ID attribute with the following regex: <regexp name="htmlId" value="[a-zA-Z0-9\:\-_\.]+"/>.  You may need to configure that further, or change the ID for your element (which would likely be a better option)