mirror of
https://github.com/penpot/penpot.git
synced 2025-01-23 23:18:48 -05:00
🐛 Fix colorpicker does not close upon switching to Dashboard
This commit is contained in:
parent
9981bc7c9a
commit
ff0b031c8b
1 changed files with 25 additions and 1 deletions
|
@ -758,10 +758,34 @@
|
|||
(keep lookup)
|
||||
(remove #(= (:frame-id %) frame-id)))
|
||||
|
||||
all-parents
|
||||
(reduce (fn [res id]
|
||||
(into res (cph/get-parent-ids objects id)))
|
||||
(d/ordered-set)
|
||||
ids)
|
||||
|
||||
find-all-empty-parents
|
||||
(fn recursive-find-empty-parents [empty-parents]
|
||||
(let [all-ids (into empty-parents ids)
|
||||
contains? (partial contains? all-ids)
|
||||
xform (comp (map lookup)
|
||||
(filter cph/group-shape?)
|
||||
(remove #(->> (:shapes %) (remove contains?) seq))
|
||||
(map :id))
|
||||
parents (into #{} xform all-parents)]
|
||||
(if (= empty-parents parents)
|
||||
empty-parents
|
||||
(recursive-find-empty-parents parents))))
|
||||
|
||||
empty-parents
|
||||
;; Any parent whose children are moved should be deleted
|
||||
(into (d/ordered-set) (find-all-empty-parents #{}))
|
||||
|
||||
changes
|
||||
(-> (pcb/empty-changes it page-id)
|
||||
(pcb/with-objects objects)
|
||||
(pcb/change-parent frame-id moving-shapes))]
|
||||
(pcb/change-parent frame-id moving-shapes)
|
||||
(pcb/remove-objects empty-parents))]
|
||||
|
||||
(when-not (empty? changes)
|
||||
(rx/of (dch/commit-changes changes)
|
||||
|
|
Loading…
Add table
Reference in a new issue