mirror of
https://github.com/penpot/penpot.git
synced 2026-05-01 14:18:07 +00:00
🐛 Fix problem when creating shapes after new page
This commit is contained in:
parent
0c0c81e9a5
commit
ddd0e447f6
@ -27,7 +27,9 @@
|
||||
[app.main.data.workspace.libraries :as dwl]
|
||||
[app.main.data.workspace.thumbnails :as dwth]
|
||||
[app.main.errors]
|
||||
[app.main.features :as features]
|
||||
[app.main.router :as rt]
|
||||
[app.render-wasm.shape :as wasm.shape]
|
||||
[app.util.http :as http]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[beicon.v2.core :as rx]
|
||||
@ -128,6 +130,14 @@
|
||||
;; Workspace Page CRUD
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defn update-page-root
|
||||
[file-id page-id]
|
||||
(ptk/reify ::update-page-root
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(-> state
|
||||
(update-in [:files file-id :data :pages-index page-id :objects uuid/zero] wasm.shape/create-shape)))))
|
||||
|
||||
(defn create-page
|
||||
[{:keys [page-id file-id]}]
|
||||
(let [id (or page-id (uuid/next))]
|
||||
@ -146,7 +156,11 @@
|
||||
changes (-> (pcb/empty-changes it)
|
||||
(pcb/add-empty-page id name))]
|
||||
|
||||
(rx/of (dch/commit-changes changes)))))))
|
||||
(rx/concat
|
||||
(rx/of (dch/commit-changes changes))
|
||||
(if (features/active-feature? state "render-wasm/v1")
|
||||
(rx/of (update-page-root file-id id))
|
||||
(rx/empty))))))))
|
||||
|
||||
(defn duplicate-page
|
||||
[page-id]
|
||||
|
||||
@ -11,7 +11,6 @@
|
||||
[app.common.transit :as t]
|
||||
[app.common.types.shape :as shape]
|
||||
[app.common.types.shape.layout :as ctl]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.render-wasm.api :as api]
|
||||
[beicon.v2.core :as rx]
|
||||
[clojure.core :as c]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user