mirror of https://github.com/artf/grapesjs.git
Browse Source
* `core:component-prev` (w) * `core:component-next` (s) * `core:component-enter` (d) * `core:component-exit` (a)multiple-select
7 changed files with 87 additions and 3 deletions
@ -0,0 +1,13 @@ |
|||
module.exports = { |
|||
run(ed) { |
|||
const toSelect = []; |
|||
|
|||
ed.getSelectedAll().forEach(component => { |
|||
const coll = component.components(); |
|||
const next = coll && coll.at(0); |
|||
next && toSelect.push(next); |
|||
}); |
|||
|
|||
toSelect.length && ed.select(toSelect); |
|||
} |
|||
}; |
|||
@ -0,0 +1,12 @@ |
|||
module.exports = { |
|||
run(ed) { |
|||
const toSelect = []; |
|||
|
|||
ed.getSelectedAll().forEach(component => { |
|||
const next = component.parent(); |
|||
next && toSelect.push(next); |
|||
}); |
|||
|
|||
toSelect.length && ed.select(toSelect); |
|||
} |
|||
}; |
|||
@ -0,0 +1,14 @@ |
|||
module.exports = { |
|||
run(ed) { |
|||
const toSelect = []; |
|||
|
|||
ed.getSelectedAll().forEach(component => { |
|||
const coll = component.collection; |
|||
const at = coll.indexOf(component); |
|||
const next = coll.at(at + 1); |
|||
toSelect.push(next || component); |
|||
}); |
|||
|
|||
toSelect.length && ed.select(toSelect); |
|||
} |
|||
}; |
|||
@ -0,0 +1,14 @@ |
|||
module.exports = { |
|||
run(ed) { |
|||
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); |
|||
} |
|||
}; |
|||
Loading…
Reference in new issue