grapesjs_codeapps
Version:
Free and Open Source Web Builder Framework/SC Modification
16 lines (13 loc) • 412 B
JavaScript
module.exports = {
run(ed) {
if (!ed.Canvas.hasFocus() || ed.getModel().isEditing()) return;
const toSelect = [];
ed.getSelectedAll().forEach(component => {
const coll = component.collection;
const at = coll.indexOf(component);
const next = coll.at(at - 1);
toSelect.push(next && at - 1 >= 0 ? next : component);
});
toSelect.length && ed.select(toSelect);
}
};