0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 23:49:45 -05:00

Enter to select children allow for multiselection

This commit is contained in:
alonso.torres 2023-01-26 14:27:14 +01:00
parent 6b225a10b5
commit 5a36cbceb7

View file

@ -839,13 +839,22 @@
(ptk/reify ::start-editing-selected
ptk/WatchEvent
(watch [_ state _]
(let [selected (wsh/lookup-selected state)]
(if-not (= 1 (count selected))
(rx/empty)
(let [selected (wsh/lookup-selected state)
objects (wsh/lookup-page-objects state)]
(let [objects (wsh/lookup-page-objects state)
{:keys [id type shapes]} (get objects (first selected))]
(if (> (count selected) 1)
(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
:text
(rx/of (dwe/start-edition-mode id))