mirror of
https://github.com/penpot/penpot.git
synced 2025-06-02 09:31:39 +02:00
🐛 Fixes problems with saved grids
This commit is contained in:
parent
0b4887ed96
commit
8dc3165e54
4 changed files with 37 additions and 7 deletions
|
@ -75,11 +75,13 @@
|
|||
ptk/WatchEvent
|
||||
(watch [_ state stream]
|
||||
(let [pid (:current-page-id state)
|
||||
prev-value (get-in state [:workspace-data pid :options :saved-grids type])]
|
||||
prev-value (get-in state [:workspace-data :pages-index pid :options :saved-grids type])]
|
||||
(rx/of (dwc/commit-changes [{:type :set-option
|
||||
:page-id pid
|
||||
:option [:saved-grids type]
|
||||
:value params}]
|
||||
[{:type :set-option
|
||||
:page-id pid
|
||||
:option [:saved-grids type]
|
||||
:value prev-value}]
|
||||
{:commit-local? true}))))))
|
||||
|
|
|
@ -140,10 +140,6 @@
|
|||
(def workspace-page-options
|
||||
(l/derived :options workspace-page))
|
||||
|
||||
;; TODO: revisit
|
||||
(def workspace-saved-grids
|
||||
(l/derived :saved-grids workspace-page-options))
|
||||
|
||||
(def workspace-frames
|
||||
(l/derived cph/select-frames workspace-page-objects))
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
(ns app.main.ui.workspace.sidebar.options.frame-grid
|
||||
(:require
|
||||
[rumext.alpha :as mf]
|
||||
[okulary.core :as l]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.data :as d]
|
||||
[app.common.math :as mth]
|
||||
|
@ -26,6 +27,9 @@
|
|||
[app.main.ui.components.dropdown :refer [dropdown]]
|
||||
[app.util.i18n :as i18n :refer [tr t]]))
|
||||
|
||||
(def workspace-saved-grids
|
||||
(l/derived :saved-grids refs/workspace-page-options))
|
||||
|
||||
(mf/defc advanced-options [{:keys [visible? on-close children]}]
|
||||
(when visible?
|
||||
[:*
|
||||
|
@ -229,7 +233,7 @@
|
|||
(mf/defc frame-grid [{:keys [shape]}]
|
||||
(let [locale (i18n/use-locale)
|
||||
id (:id shape)
|
||||
default-grid-params (merge dw/default-grid-params (mf/deref refs/workspace-saved-grids))
|
||||
default-grid-params (merge dw/default-grid-params (mf/deref workspace-saved-grids))
|
||||
handle-create-grid #(st/emit! (dw/add-frame-grid id))
|
||||
handle-remove-grid (fn [index] #(st/emit! (dw/remove-frame-grid id index)))
|
||||
handle-edit-grid (fn [index] #(st/emit! (dw/set-frame-grid id index %)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue