0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-04 05:18:56 -05:00

Add specific event for update page options.

This commit is contained in:
Andrey Antukh 2016-04-13 23:52:01 +03:00
parent 7c892cf012
commit 58a86872f5
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95
2 changed files with 16 additions and 6 deletions

View file

@ -168,6 +168,19 @@
(dissoc data :data) (dissoc data :data)
(map->UpdatePageMetadata))) (map->UpdatePageMetadata)))
;; --- Update Page Options
(defrecord UpdatePageOptions [id options]
rs/WatchEvent
(-apply-watch [this state s]
(let [page (get-in state [:pages-by-id id])
page (assoc page :options options)]
(rx/of (map->UpdatePageMetadata page)))))
(defn update-page-options
[id options]
(UpdatePageOptions. id options))
;; --- Delete Page (by id) ;; --- Delete Page (by id)
(defrecord DeletePage [id callback] (defrecord DeletePage [id callback]

View file

@ -203,12 +203,9 @@
(defrecord UpdateWorkspaceSettings [id options] (defrecord UpdateWorkspaceSettings [id options]
rs/WatchEvent rs/WatchEvent
(-apply-watch [_ state s] (-apply-watch [_ state s]
(let [page (get-in state [:pages-by-id id]) (rx/of (udp/update-page-options id options)
page (assoc page :options options)] (initialize-alignment-index id)
(rx/of (udf/clean :workspace/settings)))
(udp/update-page-metadata page)
(initialize-alignment-index id)
(udf/clean :workspace/settings))))
rs/EffectEvent rs/EffectEvent
(-apply-effect [_ state] (-apply-effect [_ state]