AEM how to listen to the style change event in the Edit Bar in AEM's edit mode. | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

anupampat
Community Advisor
Community Advisor
March 14, 2024

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

 

Johann_LuAuthor
Level 4
March 15, 2024

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

anupampat
Community Advisor
Community Advisor
March 15, 2024

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.