mirror of
https://github.com/penpot/penpot.git
synced 2025-03-12 07:41:43 -05:00
Add select page history event.
This commit is contained in:
parent
e2ad20b376
commit
b00420d457
1 changed files with 23 additions and 0 deletions
|
@ -210,3 +210,26 @@
|
||||||
(defn clean-page-history
|
(defn clean-page-history
|
||||||
[]
|
[]
|
||||||
(CleanPageHistory.))
|
(CleanPageHistory.))
|
||||||
|
|
||||||
|
;; --- Select Page History
|
||||||
|
|
||||||
|
(defrecord SelectPageHistory [page history]
|
||||||
|
rs/UpdateEvent
|
||||||
|
(-apply-update [_ state]
|
||||||
|
(let [page (get-in state [:pages-by-id page])
|
||||||
|
page' (assoc page
|
||||||
|
:history true
|
||||||
|
:data (:data history)
|
||||||
|
:version (:version history))]
|
||||||
|
(-> state
|
||||||
|
(stpr/unpack-page page')
|
||||||
|
(assoc-in [:workspace :history :selected] (:id history))
|
||||||
|
(update-in [:workspace :history]
|
||||||
|
(fn [v]
|
||||||
|
(if (:current-version v)
|
||||||
|
v
|
||||||
|
(assoc v :current-version (:version page)))))))))
|
||||||
|
|
||||||
|
(defn select-page-history
|
||||||
|
[id history]
|
||||||
|
(SelectPageHistory. id history))
|
||||||
|
|
Loading…
Add table
Reference in a new issue