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.
22 lines
618 B
22 lines
618 B
import Component from '../../dom_components/model/Component';
|
|
import { CommandObject } from './CommandAbstract';
|
|
|
|
export default {
|
|
run(ed, snd, opts = {}) {
|
|
if (!ed.Canvas.hasFocus() && !opts.force) return;
|
|
const toSelect: Component[] = [];
|
|
|
|
ed.getSelectedAll().forEach((component) => {
|
|
let next = component.parent();
|
|
|
|
// Recurse through the parent() chain until a selectable parent is found
|
|
while (next && !next.get('selectable')) {
|
|
next = next.parent();
|
|
}
|
|
|
|
next && toSelect.push(next);
|
|
});
|
|
|
|
toSelect.length && ed.select(toSelect);
|
|
},
|
|
} as CommandObject;
|
|
|