0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 07:29:08 -05:00

🐛 Fix undo when deleting shapes inside instances (ok)

This commit is contained in:
Andrés Moya 2023-05-16 10:49:32 +02:00 committed by Andrés Moya
parent 68367b002e
commit 30dd9c5222
2 changed files with 13 additions and 11 deletions

View file

@ -208,10 +208,15 @@
(recur (rest ids-seq) (recur (rest ids-seq)
(conj ids-to-delete id) (conj ids-to-delete id)
ids-to-hide))))) ids-to-hide)))))
[ids []])] [ids []])
(rx/concat (rx/of (update-shape-flags ids-to-hide {:hidden true})) undo-id (js/Symbol)]
(real-delete-shapes file page objects ids-to-delete it components-v2)))))))
(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 (defn- real-delete-shapes
[file page objects ids it components-v2] [file page objects ids it components-v2]
@ -331,14 +336,11 @@
(cond-> (seq starting-flows) (cond-> (seq starting-flows)
(pcb/update-page-option :flows (fn [flows] (pcb/update-page-option :flows (fn [flows]
(->> (map :id starting-flows) (->> (map :id starting-flows)
(reduce ctp/remove-flow flows)))))) (reduce ctp/remove-flow flows))))))]
undo-id (js/Symbol)]
(rx/of (dwu/start-undo-transaction undo-id) (rx/of (dc/detach-comment-thread ids)
(dc/detach-comment-thread ids)
(ptk/data-event :layout/update all-parents) (ptk/data-event :layout/update all-parents)
(dch/commit-changes changes) (dch/commit-changes changes))))
(dwu/commit-undo-transaction undo-id))))
(defn create-and-add-shape (defn create-and-add-shape
[type frame-x frame-y data] [type frame-x frame-y data]