mirror of
https://github.com/penpot/penpot.git
synced 2025-02-08 16:18:11 -05:00
🐛 Fix restore component on library with deleted page
This commit is contained in:
parent
d938802ecf
commit
da4ba3c9fe
2 changed files with 10 additions and 1 deletions
|
@ -13,6 +13,12 @@
|
|||
[file-data id]
|
||||
(dm/get-in file-data [:pages-index id]))
|
||||
|
||||
(defn get-last-page
|
||||
[file-data]
|
||||
(let [id (-> file-data :pages last)]
|
||||
(when id
|
||||
(get-page file-data id))))
|
||||
|
||||
(defn add-page
|
||||
[file-data {:keys [id index] :as page}]
|
||||
(-> file-data
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
[app.common.types.components-list :as ctkl]
|
||||
[app.common.types.container :as ctn]
|
||||
[app.common.types.file :as ctf]
|
||||
[app.common.types.pages-list :as ctpl]
|
||||
[app.common.types.shape-tree :as ctst]
|
||||
[app.common.types.shape.layout :as ctl]
|
||||
[app.common.types.typography :as cty]
|
||||
|
@ -234,7 +235,9 @@
|
|||
([library-data component-id current-page it]
|
||||
(let [component (ctkl/get-deleted-component library-data component-id)
|
||||
page (or (ctf/get-component-page library-data component)
|
||||
current-page)]
|
||||
(when (some #(= (:id current-page) %) (:pages library-data)) ;; If the page doesn't belong to the library, it's not valid
|
||||
current-page)
|
||||
(ctpl/get-last-page library-data))]
|
||||
(prepare-restore-component nil library-data component-id it page (gpt/point 0 0) nil nil)))
|
||||
|
||||
([changes library-data component-id it page delta old-id parent-id]
|
||||
|
|
Loading…
Add table
Reference in a new issue