Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

AEM how to listen to the style change event in the Edit Bar in AEM's edit mode.

Avatar

Level 4

AEM how to listen to the style change event in the Edit Bar in AEM's edit mode.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Level 5

Ideally yes you could if you target the class one of the OOTB classes like 'editor-styleselector-form' and write your logic based on change or click, but this will not be consistent.

3 Replies

Avatar

Level 5

Hi @Johann_Lu ,

 

The styles under the edit bar are associated to cq:styleId which are stored under Template policies. You can create a custom event listener and listen to change for cq:styleId property under the content path, e.g.

/content/<pagePath>/jcr:content/root/main/responsivegrid/cards1

anupamp17770278_0-1710413574498.png

 

Avatar

Level 4

It is a good method, but I want to do this in js, is it possible?

Avatar

Level 5

Ideally yes you could if you target the class one of the OOTB classes like 'editor-styleselector-form' and write your logic based on change or click, but this will not be consistent.