Issue #2530Opened January 24, 2020by alemenciones1 reactions

how to drag parent component from selectable child

Question

i have a component type "table" and i find move this table draging her inner components (selectables/stylables) (th, td, ...) this is posible? thanks a lots

Answers (2)

alemencionesJanuary 27, 20201 reactions
Code SnippetTEXT
thanks man, but, i was looking for something like this (just for absolute mode)

`
editor.on("run:tlb-move:before", (targetCollection) => {

       // Obtengo referencias al componente seleccionado
        var target = targetCollection.target;
        var el = target.view.el;

        //Verifico si tengo un componente padre que me interese
        var component = !!el.closest("table") ? "table" : !!el.closest("form") ? !!el.closest("form").attributes["data-ic-profiling-form"] ? "profiling-form" : "form" :  null;

        //Si tengo padre y el hijo no es arrastrable
        if (component && !target.get("draggable")) {

            //functión para recorrer los componentes padres
            var findParentContainerComponent = parent => {

                //Si estoy parado en el padre actualizo el drag-target
                if (parent.get("type") === component) {

                    //Actualizo el target y detengo el bucle
                    targetCollection.target = parent;
                    return ;
                }

                //Busco al padre del elemento actual
                findParentContainerComponent(parent.parent());
            };

            //Busco y selecciono el componente padre que me interesa
            findParentContainerComponent(target);

        }
    });
`
pouyamiralayiJanuary 25, 20200 reactions

@alemenciones Select parent using the arrow icon:

arrow

then drag parent like below:

plus

Cheers!

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.