🐛 Add undo to set default grid options operation

This commit is contained in:
Andrés Moya 2020-06-10 14:14:51 +02:00 committed by Andrey Antukh
parent 51acd2b529
commit f63657509f
4 changed files with 36 additions and 11 deletions

View file

@ -649,8 +649,6 @@
:left (gpt/point (- 1) 0)
:right (gpt/point 1 0)))
(s/def ::loc #{:up :down :bottom :top})
;; --- Delete Selected
(defn- delete-shapes
[ids]
@ -724,6 +722,8 @@
;; --- Shape Vertical Ordering
(s/def ::loc #{:up :down :bottom :top})
(defn vertical-order-selected
[loc]
(us/verify ::loc loc)

View file

@ -76,8 +76,12 @@
(ptk/reify ::set-default-grid
ptk/WatchEvent
(watch [_ state stream]
(rx/of (dwc/commit-changes [{:type :set-option
:option [:saved-grids type]
:value params}]
[]
{:commit-local? true})))))
(let [pid (:current-page-id state)
prev-value (get-in state [:workspace-data pid :options :saved-grids type])]
(rx/of (dwc/commit-changes [{:type :set-option
:option [:saved-grids type]
:value params}]
[{:type :set-option
:option [:saved-grids type]
:value prev-value}]
{:commit-local? true}))))))