mirror of
https://github.com/penpot/penpot.git
synced 2025-01-22 14:39:45 -05:00
🐛 Fix bad page-id on undo delete component
This commit is contained in:
parent
3620e6b4d7
commit
be31371892
5 changed files with 10 additions and 7 deletions
|
@ -210,7 +210,8 @@
|
|||
[:restore-component
|
||||
[:map {:title "RestoreComponentChange"}
|
||||
[:type [:= :restore-component]]
|
||||
[:id ::sm/uuid]]]
|
||||
[:id ::sm/uuid]
|
||||
[:page-id ::sm/uuid]]]
|
||||
|
||||
[:purge-component
|
||||
[:map {:title "PurgeComponentChange"}
|
||||
|
|
|
@ -742,13 +742,14 @@
|
|||
changes)))
|
||||
|
||||
(defn delete-component
|
||||
[changes id]
|
||||
[changes id page-id]
|
||||
(assert-library! changes)
|
||||
(-> changes
|
||||
(update :redo-changes conj {:type :del-component
|
||||
:id id})
|
||||
(update :undo-changes conj {:type :restore-component
|
||||
:id id})))
|
||||
:id id
|
||||
:page-id page-id})))
|
||||
|
||||
(defn restore-component
|
||||
([changes id]
|
||||
|
|
|
@ -551,7 +551,7 @@
|
|||
(map :component-id))
|
||||
|
||||
changes (reduce (fn [changes component-id]
|
||||
(pcb/delete-component changes component-id))
|
||||
(pcb/delete-component changes component-id (:id page)))
|
||||
changes
|
||||
components-to-delete)]
|
||||
changes))
|
||||
|
|
|
@ -483,9 +483,10 @@
|
|||
(rx/of
|
||||
(dwt/clear-thumbnail (:current-file-id state) page-id root-id "component")
|
||||
(dwsh/delete-shapes page-id #{root-id}))) ;; Deleting main root triggers component delete
|
||||
(let [changes (-> (pcb/empty-changes it)
|
||||
(let [page-id (:current-page-id state)
|
||||
changes (-> (pcb/empty-changes it)
|
||||
(pcb/with-library-data data)
|
||||
(pcb/delete-component id))]
|
||||
(pcb/delete-component id page-id))]
|
||||
(rx/of (dch/commit-changes changes))))))))
|
||||
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@
|
|||
changes (reduce (fn [changes component-id]
|
||||
;; It's important to delete the component before the main instance, because we
|
||||
;; need to store the instance position if we want to restore it later.
|
||||
(pcb/delete-component changes component-id))
|
||||
(pcb/delete-component changes component-id (:id page)))
|
||||
changes
|
||||
components-to-delete)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue