Last active
August 24, 2022 02:01
-
-
Save kevinweber/925a94d3ee148104ca5e44f5ddd10946 to your computer and use it in GitHub Desktop.
AEM: Add JavaScript (including events) to AEM loaded on editor.html. Solution: Create clientlib with category "cq.authoring.dialog". Exemplary usage: Reload page if layer changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" | |
jcr:primaryType="cq:ClientLibraryFolder" | |
categories="[cq.authoring.dialog]"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
'use strict'; | |
function onModeChange() { | |
location.reload(); | |
} | |
function reloadOnModeChange() { | |
document.querySelectorAll('.js-editor-LayerSwitcherTrigger').forEach(function (element) { | |
element.addEventListener('click', onModeChange); | |
}); | |
} | |
reloadOnModeChange(); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment