Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Aem targetparsys内的Parsys(targerparsys)_Aem_Targeting - Fatal编程技术网

Aem targetparsys内的Parsys(targerparsys)

Aem targetparsys内的Parsys(targerparsys),aem,targeting,Aem,Targeting,我们有一个目标区域target和targetparsys with component,这是一个容器parsys with一些组件。问题是,当此容器位于目标区域时,容器的parsys将成为targetparsys,其中无法编辑内部组件。这个问题有解决办法吗 我尝试在overlymanager.js中覆盖创建覆盖的逻辑。它已经解决了一点问题,但是没有一个适当的工作来重新排序其中的组件。我通过更改和添加以下代码覆盖了以下文件-/cq/gui/components/authoring/editors/

我们有一个目标区域target和targetparsys with component,这是一个容器parsys with一些组件。问题是,当此容器位于目标区域时,容器的parsys将成为targetparsys,其中无法编辑内部组件。这个问题有解决办法吗


我尝试在overlymanager.js中覆盖创建覆盖的逻辑。它已经解决了一点问题,但是没有一个适当的工作来重新排序其中的组件。

我通过更改和添加以下代码覆盖了以下文件-/cq/gui/components/authoring/editors/clientlibs/core/js/overlymanager.js:

     self.create = function (editable) {
        if (!editable.overlay) {
            var parent = ns.editables.getParent(editable);

            // going up recursively until we reach the root container
            if (parent && !parent.overlay) {
                self.create(parent);
            }

            // we check again because a child overlay might also be created by the parent constructor
            if (!editable.overlay) {
                editable.overlay = new overlayConstructor(editable, parent ? parent.overlay.dom : container);
            }

            // get children sorted by depth of their paths
            var sortedChildren = getSortedChildren(editable, true);

            //and going down recursively until we reach the deepest editable
            sortedChildren.forEach(function (child) {
                self.create(child);
            });
        }
    };

    /**
    *  Returns the sorted {Array} of child {@link Granite.author.Editable}s by depth of their paths for the given {@link Granite.author.Editable}
    *
    *  @param {Granite.author.Editable} editable - {@link Granite.author.Editable} for which to find child editables to be sorted by depth of their paths
    *  @param {Boolean} all - All the children or only the direct descendant
    *
    *  WARNING! Not OTB function! See the description on {self.create = function(editable)}
    */
    function getSortedChildren(editable, all){
        var children = ns.editables.getChildren(editable, all);

        //key - editable, value - number of slashes
        var childrenMap = new Map();

        //going through all children
        for (let i = 0; i < children.length; i++){
            var path = children[i].path;

            var numberOfSlashes = 1;
            var isFirstSlashChecked = false;
            //searching slashes
            for (let j = 0; j < path.length; j++){
                var letter = path[j];

                var SLASH = '/';
                if (letter == SLASH){
                    if (isFirstSlashChecked){
                        childrenMap.set(children[i], ++numberOfSlashes);
                    } else {
                        childrenMap.set(children[i], numberOfSlashes);
                        isFirstSlashChecked = true;
                    }
                }
            }

            //if there are not slashes in editable path
            if (!isFirstSlashChecked){
                childrenMap.set(children[i], 0);
            }
        }

        //sort map by depth (number of slashes)
        var sortedChildrenMapByPaths = new Map([...childrenMap.entries()].sort((a, b) => a[1] - b[1])); 

        //return sorted editables
        return Array.from(sortedChildrenMapByPaths.keys());
    }

你能解决这个问题吗?嗨@ronnyfm,是的,我可以向你展示叠加的代码,这对我很有帮助。我通过更改和添加以下代码,叠加了以下文件-/cq/gui/components/authoring/editors/clientlibs/core/js/overlymanager.js:
    function repositionOverlay(editable) {
        var parent;
        // if there is no overlay in place, don't bother we ignore it (most likely timing issue)
        if (editable.overlay) {
            parent = ns.editables.getParent(editable);

            //the place which was overlaid
            // don't rely on order of editables in the store...
            if (parent && parent.overlay != null && !parent.overlay.currentPos) {
                repositionOverlay(parent);
            }

            editable.overlay.position(editable, parent);
        }
    }