Adding JS via cq authoring dialog in AEM: AEM uses client library to manage js and css. Client libraries are registered globally in aem using a category name.
You give a category for it's identification and then we call on the category to add js and css to the browser. AEM has a category specifically for dialogs and that is called cq.authoring.dialog. SO, we can create client library with the category cq.autoring.dialog to use any custom js within our dialog.
Important point to note is that adding js this way will add it to every dialog with an AEM, even the dialogs that come out of the box.
When granite ui injects new content into the DOM, I mean when granite ui load a dialog the Foundation-contentloaded event is triggered. When listening for this event, the container is available at the event targent. IT is recommended that the listener uses the container to scope it's operation because event could be firing many times and you want to keep the javascript scoped to its purpose..
Create the client library with the category cq.authoring.dialog, add the js within it. In js, I have used cosole.log to print some msg on cl call and below we are listening for the event and when the event occurs, we will fire this anonymous function. Container is the event target. When this event is fired we should see some msg.
share, support, like and subscribe
Subscribe : https://www.youtube.com/channel/UC5Lc...
LinkedIn : / pankaj-ch. .
Facebook : / pankajchhatri
Twitter : / pankajchhatri
Google plus : https://plus.google.com/u/0/+pankajch...
About : AEM/CQ5 tutorial is a youtube channel which helps you to learn AEM concepts theoretically as well as practically.
Смотрите видео 75. Adding JS via cq authoring dialog in AEM онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь AEM and Devops Tutorial 09 Декабрь 2018, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 11,995 раз и оно понравилось 49 людям.