mirror of
https://github.com/penpot/penpot.git
synced 2025-01-08 07:50:43 -05:00
🐛 Fix undo when deleting shapes inside instances (ok)
This commit is contained in:
parent
68367b002e
commit
30dd9c5222
2 changed files with 13 additions and 11 deletions
|
@ -208,10 +208,15 @@
|
|||
(recur (rest ids-seq)
|
||||
(conj ids-to-delete id)
|
||||
ids-to-hide)))))
|
||||
[ids []])]
|
||||
[ids []])
|
||||
|
||||
(rx/concat (rx/of (update-shape-flags ids-to-hide {:hidden true}))
|
||||
(real-delete-shapes file page objects ids-to-delete it components-v2)))))))
|
||||
undo-id (js/Symbol)]
|
||||
|
||||
(rx/concat
|
||||
(rx/of (dwu/start-undo-transaction undo-id)
|
||||
(update-shape-flags ids-to-hide {:hidden true}))
|
||||
(real-delete-shapes file page objects ids-to-delete it components-v2)
|
||||
(rx/of (dwu/commit-undo-transaction undo-id))))))))
|
||||
|
||||
(defn- real-delete-shapes
|
||||
[file page objects ids it components-v2]
|
||||
|
@ -331,14 +336,11 @@
|
|||
(cond-> (seq starting-flows)
|
||||
(pcb/update-page-option :flows (fn [flows]
|
||||
(->> (map :id starting-flows)
|
||||
(reduce ctp/remove-flow flows))))))
|
||||
undo-id (js/Symbol)]
|
||||
(reduce ctp/remove-flow flows))))))]
|
||||
|
||||
(rx/of (dwu/start-undo-transaction undo-id)
|
||||
(dc/detach-comment-thread ids)
|
||||
(rx/of (dc/detach-comment-thread ids)
|
||||
(ptk/data-event :layout/update all-parents)
|
||||
(dch/commit-changes changes)
|
||||
(dwu/commit-undo-transaction undo-id))))
|
||||
(dch/commit-changes changes))))
|
||||
|
||||
(defn create-and-add-shape
|
||||
[type frame-x frame-y data]
|
||||
|
|
|
@ -358,7 +358,7 @@
|
|||
file (wsh/get-local-file new-state)
|
||||
component2 (ctkl/get-component file (thp/id :component1))
|
||||
component3 (ctkl/get-deleted-component file (thp/id :component1))
|
||||
|
||||
|
||||
saved-objects (:objects component3)
|
||||
saved-main1 (get saved-objects (:shape-ref instance1))
|
||||
saved-shape2 (get saved-objects (:shape-ref shape2))]
|
||||
|
@ -381,7 +381,7 @@
|
|||
(t/is (= (:name component3) "Rect 1"))
|
||||
(t/is (= (:deleted component3) true))
|
||||
(t/is (some? (:objects component3)))
|
||||
|
||||
|
||||
(t/is (= (:name saved-main1) "Rect 1"))
|
||||
(t/is (= (:name saved-shape2) "Rect 1")))))]
|
||||
|
||||
|
|
Loading…
Reference in a new issue