mirror of
https://github.com/penpot/penpot.git
synced 2025-07-27 01:37:19 +02:00
✨ Enter to select children allow for multiselection
This commit is contained in:
parent
6b225a10b5
commit
5a36cbceb7
1 changed files with 14 additions and 5 deletions
|
@ -839,13 +839,22 @@
|
||||||
(ptk/reify ::start-editing-selected
|
(ptk/reify ::start-editing-selected
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ state _]
|
(watch [_ state _]
|
||||||
(let [selected (wsh/lookup-selected state)]
|
(let [selected (wsh/lookup-selected state)
|
||||||
(if-not (= 1 (count selected))
|
objects (wsh/lookup-page-objects state)]
|
||||||
(rx/empty)
|
|
||||||
|
|
||||||
(let [objects (wsh/lookup-page-objects state)
|
(if (> (count selected) 1)
|
||||||
{:keys [id type shapes]} (get objects (first selected))]
|
(let [shapes-to-select
|
||||||
|
(->> selected
|
||||||
|
(reduce
|
||||||
|
(fn [result shape-id]
|
||||||
|
(let [children (dm/get-in objects [shape-id :shapes])]
|
||||||
|
(if (empty? children)
|
||||||
|
(conj result shape-id)
|
||||||
|
(into result children))))
|
||||||
|
(d/ordered-set)))]
|
||||||
|
(rx/of (dws/select-shapes shapes-to-select)))
|
||||||
|
|
||||||
|
(let [{:keys [id type shapes]} (get objects (first selected))]
|
||||||
(case type
|
(case type
|
||||||
:text
|
:text
|
||||||
(rx/of (dwe/start-edition-mode id))
|
(rx/of (dwe/start-edition-mode id))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue