mirror of https://github.com/artf/grapesjs.git
nocodeframeworkdrag-and-dropsite-buildersite-generatortemplate-builderui-builderweb-builderweb-builder-frameworkwebsite-builderno-codepage-builder
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
557 B
26 lines
557 B
export default {
|
|
run(ed) {
|
|
if (!ed.Canvas.hasFocus()) return;
|
|
const toSelect = [];
|
|
|
|
ed.getSelectedAll().forEach(cmp => {
|
|
const parent = cmp.parent();
|
|
if (!parent) return;
|
|
|
|
let incr = 0;
|
|
let at = 0;
|
|
let next;
|
|
|
|
// Get the first selectable component
|
|
do {
|
|
incr++;
|
|
at = cmp.index() - incr;
|
|
next = at >= 0 ? parent.getChildAt(at) : null;
|
|
} while (next && !next.get('selectable'));
|
|
|
|
toSelect.push(next || cmp);
|
|
});
|
|
|
|
toSelect.length && ed.select(toSelect);
|
|
},
|
|
};
|
|
|