mirror of
https://github.com/penpot/penpot.git
synced 2025-02-08 16:18:11 -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
|
[:restore-component
|
||||||
[:map {:title "RestoreComponentChange"}
|
[:map {:title "RestoreComponentChange"}
|
||||||
[:type [:= :restore-component]]
|
[:type [:= :restore-component]]
|
||||||
[:id ::sm/uuid]]]
|
[:id ::sm/uuid]
|
||||||
|
[:page-id ::sm/uuid]]]
|
||||||
|
|
||||||
[:purge-component
|
[:purge-component
|
||||||
[:map {:title "PurgeComponentChange"}
|
[:map {:title "PurgeComponentChange"}
|
||||||
|
|
|
@ -742,13 +742,14 @@
|
||||||
changes)))
|
changes)))
|
||||||
|
|
||||||
(defn delete-component
|
(defn delete-component
|
||||||
[changes id]
|
[changes id page-id]
|
||||||
(assert-library! changes)
|
(assert-library! changes)
|
||||||
(-> changes
|
(-> changes
|
||||||
(update :redo-changes conj {:type :del-component
|
(update :redo-changes conj {:type :del-component
|
||||||
:id id})
|
:id id})
|
||||||
(update :undo-changes conj {:type :restore-component
|
(update :undo-changes conj {:type :restore-component
|
||||||
:id id})))
|
:id id
|
||||||
|
:page-id page-id})))
|
||||||
|
|
||||||
(defn restore-component
|
(defn restore-component
|
||||||
([changes id]
|
([changes id]
|
||||||
|
|
|
@ -551,7 +551,7 @@
|
||||||
(map :component-id))
|
(map :component-id))
|
||||||
|
|
||||||
changes (reduce (fn [changes component-id]
|
changes (reduce (fn [changes component-id]
|
||||||
(pcb/delete-component changes component-id))
|
(pcb/delete-component changes component-id (:id page)))
|
||||||
changes
|
changes
|
||||||
components-to-delete)]
|
components-to-delete)]
|
||||||
changes))
|
changes))
|
||||||
|
|
|
@ -483,9 +483,10 @@
|
||||||
(rx/of
|
(rx/of
|
||||||
(dwt/clear-thumbnail (:current-file-id state) page-id root-id "component")
|
(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
|
(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/with-library-data data)
|
||||||
(pcb/delete-component id))]
|
(pcb/delete-component id page-id))]
|
||||||
(rx/of (dch/commit-changes changes))))))))
|
(rx/of (dch/commit-changes changes))))))))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -240,7 +240,7 @@
|
||||||
changes (reduce (fn [changes component-id]
|
changes (reduce (fn [changes component-id]
|
||||||
;; It's important to delete the component before the main instance, because we
|
;; 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.
|
;; 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
|
changes
|
||||||
components-to-delete)
|
components-to-delete)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue