AEM 6 SP2 - Show Confirm Box before Node Move in CRXDE Lite

This is an unconventional way of extending CRXDE Lite; for desperate situations only


This post is on showing confirm prompt when user attempts node move in CRXDE Lite (http://localhost:4502/crx/de) or use shift key + move for moving a node

Ext.Msg.confirm works asynchronously, so if a confirm box is absolutely needed use browser confirm

Demo | Package Install

Confirm Prompt

No Shift Press while Drag


Follow the two steps below to extend CRXDE Lite and add necessary JS to show confirm. First step is Not Upgrade-Proof, so when CQ is upgraded, the first step may have to be repeated

Step 1 - Update CRXDE Lite Jar

All we do in this step is copy (back it up just in case if something goes wrong) the serialized CRXDE lite jar, open it and add a small chunk of JS code so that any extensions we code are loaded by the added JS logic when lite is opened in browser.

1) Access bundles console http://localhost:4502/system/console/bundles and find the CRXDE Support bundle

2) Search for the serialized bundle on filesystem and copy it to a temp location (take a backup before modifying). On my AEM 6 SP2 its available in author\crx-quickstart\launchpad\installer (rsrc-com.adobe.granite.crxde-lite-1.0.66-CQ600-B0001.jar-1415034571045.ser)

3) Rename the copied .ser file to .jar (eg. rsrc-com.adobe.granite.crxde-lite-1.0.66-CQ600-B0001.jar-1415034571045.ser -> rsrc-com.adobe.granite.crxde-lite-1.0.66-CQ600-B0001.jar)

4) Open the jar using zip executable (say winrar), open file docroot\js\start.js in any text editor and add following code at the end. Save file and a winrar confirmation should popup asking if the jar should be updated with saved file.

Ext.onReady(function() {
    var loadLiteExtns = function(){
            url: "/apps/ext-crxde-lite/files.txt",
            success: function(response, options) {
                var js = response.responseText;
                js = js.split("\n");
                Ext.each(js, function(jsPath) {
                        url: jsPath,
                        success: function(response, options) {

5) In the above steps we added necessary code to load the extension files entered in /apps/ext-crxde-lite/files.txt. So whenever a new CRXDE Lite extension is needed a new line with extension file path can be added in /apps/ext-crxde-lite/files.txt

6) Access http://localhost:4502/system/console/bundles, click Install/Update... to upload and update CQ with the new CRXDE Support jar having necessary code to load the CRXDE Lite extension files.

Step 2 - Add extension files in CRX

In this step we add the JS file containing logic to show confirm

1) Access http://localhost:4502/crx/de

2) Create node /apps/ext-crxde-lite of type nt:folder

3) Create node /apps/ext-crxde-lite/files.txt of type nt:file and add the following line. The logic added in Step 1 reads this file for loading JS extension files added as paths


4) Create node /apps/crxde-move-node-confirm/move-confirm.js of type nt:file and add the following code

    var INTERVAL = setInterval(function(){
        var tree = Ext.getCmp(CRX.ide.TREE_ID);



        var listeners = tree.initialConfig.listeners;

        tree.removeListener("beforenodedrop", listeners.beforenodedrop, tree);

        tree.on("beforenodedrop", function(dropEvent){
            /*var r = confirm("You are trying to move a node, Are you sure?");

            if (r) {
                return, dropEvent);
            } else {
                return false;

            //uncomment this block for stopping node move, with no shift key press
            var shiftKey = dropEvent.rawEvent.browserEvent.shiftKey;

                Ext.Msg.alert("Alert", "If you'd like to move a node, press shift on keyboard before dragging");
                return false;

            return, dropEvent);
    }, 250);

No comments:

Post a Comment