-
-
Save besimhu/d8d6cfa07950e9f3ed0cf68a9ddfebf7 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 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 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