mirror of
https://github.com/penpot/penpot.git
synced 2025-02-04 13:29:14 -05:00
♻️ Change uuid/next for js/Symbol on undo-id for transactions
This commit is contained in:
parent
31dfdf51c9
commit
4f81f9636a
9 changed files with 29 additions and 33 deletions
|
@ -1618,7 +1618,7 @@
|
||||||
:height height
|
:height height
|
||||||
:grow-type (if (> (count text) 100) :auto-height :auto-width)
|
:grow-type (if (> (count text) 100) :auto-height :auto-width)
|
||||||
:content (as-content text)}
|
:content (as-content text)}
|
||||||
undo-id (uuid/next)]
|
undo-id (js/Symbol)]
|
||||||
|
|
||||||
(rx/of (dwu/start-undo-transaction undo-id)
|
(rx/of (dwu/start-undo-transaction undo-id)
|
||||||
(dwsh/create-and-add-shape :text x y shape)
|
(dwsh/create-and-add-shape :text x y shape)
|
||||||
|
|
|
@ -246,7 +246,7 @@
|
||||||
|
|
||||||
:always
|
:always
|
||||||
(ctsi/set-destination (:id target-frame))))
|
(ctsi/set-destination (:id target-frame))))
|
||||||
undo-id (uuid/next)]
|
undo-id (js/Symbol)]
|
||||||
|
|
||||||
(rx/of
|
(rx/of
|
||||||
(dwu/start-undo-transaction undo-id)
|
(dwu/start-undo-transaction undo-id)
|
||||||
|
|
|
@ -154,7 +154,7 @@
|
||||||
(pcb/with-library-data data)
|
(pcb/with-library-data data)
|
||||||
(pcb/update-color color))
|
(pcb/update-color color))
|
||||||
|
|
||||||
undo-id (uuid/next)]
|
undo-id (js/Symbol)]
|
||||||
(rx/of (dwu/start-undo-transaction undo-id)
|
(rx/of (dwu/start-undo-transaction undo-id)
|
||||||
(dch/commit-changes changes)
|
(dch/commit-changes changes)
|
||||||
(sync-file (:current-file-id state) file-id :colors (:id color))
|
(sync-file (:current-file-id state) file-id :colors (:id color))
|
||||||
|
@ -259,7 +259,7 @@
|
||||||
changes (-> (pcb/empty-changes it)
|
changes (-> (pcb/empty-changes it)
|
||||||
(pcb/with-library-data data)
|
(pcb/with-library-data data)
|
||||||
(pcb/update-typography typography))
|
(pcb/update-typography typography))
|
||||||
undo-id (uuid/next)]
|
undo-id (js/Symbol)]
|
||||||
(rx/of (dwu/start-undo-transaction undo-id)
|
(rx/of (dwu/start-undo-transaction undo-id)
|
||||||
(dch/commit-changes changes)
|
(dch/commit-changes changes)
|
||||||
(sync-file (:current-file-id state) file-id :typographies (:id typography))
|
(sync-file (:current-file-id state) file-id :typographies (:id typography))
|
||||||
|
@ -650,7 +650,7 @@
|
||||||
(let [current-file-id (:current-file-id state)
|
(let [current-file-id (:current-file-id state)
|
||||||
page (wsh/lookup-page state)
|
page (wsh/lookup-page state)
|
||||||
shape (ctn/get-shape page shape-id)
|
shape (ctn/get-shape page shape-id)
|
||||||
undo-id (uuid/next)]
|
undo-id (js/Symbol)]
|
||||||
(rx/of
|
(rx/of
|
||||||
(dwu/start-undo-transaction undo-id)
|
(dwu/start-undo-transaction undo-id)
|
||||||
(update-component shape-id)
|
(update-component shape-id)
|
||||||
|
@ -664,7 +664,7 @@
|
||||||
(ptk/reify ::update-component-in-bulk
|
(ptk/reify ::update-component-in-bulk
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ _ _]
|
(watch [_ _ _]
|
||||||
(let [undo-id (uuid/next)]
|
(let [undo-id (js/Symbol)]
|
||||||
(rx/concat
|
(rx/concat
|
||||||
(rx/of (dwu/start-undo-transaction undo-id))
|
(rx/of (dwu/start-undo-transaction undo-id))
|
||||||
(rx/map #(update-component-sync (:id %) file-id) (rx/from shapes))
|
(rx/map #(update-component-sync (:id %) file-id) (rx/from shapes))
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
[app.common.types.modifiers :as ctm]
|
[app.common.types.modifiers :as ctm]
|
||||||
[app.common.types.shape :as cts]
|
[app.common.types.shape :as cts]
|
||||||
[app.common.types.shape.layout :as ctl]
|
[app.common.types.shape.layout :as ctl]
|
||||||
[app.common.uuid :as uuid]
|
|
||||||
[app.main.data.workspace.changes :as dch]
|
[app.main.data.workspace.changes :as dch]
|
||||||
[app.main.data.workspace.comments :as-alias dwcm]
|
[app.main.data.workspace.comments :as-alias dwcm]
|
||||||
[app.main.data.workspace.guides :as-alias dwg]
|
[app.main.data.workspace.guides :as-alias dwg]
|
||||||
|
@ -343,7 +342,7 @@
|
||||||
shapes (map (d/getf objects) ids)
|
shapes (map (d/getf objects) ids)
|
||||||
ignore-tree (->> (map #(get-ignore-tree object-modifiers objects %) shapes)
|
ignore-tree (->> (map #(get-ignore-tree object-modifiers objects %) shapes)
|
||||||
(reduce merge {}))
|
(reduce merge {}))
|
||||||
undo-id (uuid/next)]
|
undo-id (js/Symbol)]
|
||||||
|
|
||||||
(rx/concat
|
(rx/concat
|
||||||
(if undo-transation?
|
(if undo-transation?
|
||||||
|
|
|
@ -561,7 +561,7 @@
|
||||||
frames (into #{}
|
frames (into #{}
|
||||||
(map #(get-in objects [% :frame-id]))
|
(map #(get-in objects [% :frame-id]))
|
||||||
selected)
|
selected)
|
||||||
undo-id (uuid/next)]
|
undo-id (js/Symbol)]
|
||||||
|
|
||||||
(rx/concat
|
(rx/concat
|
||||||
(->> (rx/from dup-frames)
|
(->> (rx/from dup-frames)
|
||||||
|
|
|
@ -380,7 +380,7 @@
|
||||||
(cond-> (not= frame-id uuid/zero)
|
(cond-> (not= frame-id uuid/zero)
|
||||||
(assoc :fills [] :hide-in-viewer true))
|
(assoc :fills [] :hide-in-viewer true))
|
||||||
(cts/setup-rect-selrect))
|
(cts/setup-rect-selrect))
|
||||||
undo-id (uuid/next)]
|
undo-id (js/Symbol)]
|
||||||
(rx/of
|
(rx/of
|
||||||
(dwu/start-undo-transaction undo-id)
|
(dwu/start-undo-transaction undo-id)
|
||||||
(add-shape shape)
|
(add-shape shape)
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
[app.common.types.modifiers :as ctm]
|
[app.common.types.modifiers :as ctm]
|
||||||
[app.common.types.shape-tree :as ctst]
|
[app.common.types.shape-tree :as ctst]
|
||||||
[app.common.types.shape.layout :as ctl]
|
[app.common.types.shape.layout :as ctl]
|
||||||
[app.common.uuid :as uuid]
|
|
||||||
[app.main.data.workspace.changes :as dch]
|
[app.main.data.workspace.changes :as dch]
|
||||||
[app.main.data.workspace.collapse :as dwc]
|
[app.main.data.workspace.collapse :as dwc]
|
||||||
[app.main.data.workspace.modifiers :as dwm]
|
[app.main.data.workspace.modifiers :as dwm]
|
||||||
|
@ -509,7 +508,7 @@
|
||||||
(rx/last)
|
(rx/last)
|
||||||
(rx/mapcat
|
(rx/mapcat
|
||||||
(fn [[_ target-frame drop-index]]
|
(fn [[_ target-frame drop-index]]
|
||||||
(let [undo-id (uuid/next)]
|
(let [undo-id (js/Symbol)]
|
||||||
(rx/of (dwu/start-undo-transaction undo-id)
|
(rx/of (dwu/start-undo-transaction undo-id)
|
||||||
(move-shapes-to-frame ids target-frame drop-index)
|
(move-shapes-to-frame ids target-frame drop-index)
|
||||||
(dwm/apply-modifiers {:undo-transation? false})
|
(dwm/apply-modifiers {:undo-transation? false})
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
[app.common.pages.helpers :as cph]
|
[app.common.pages.helpers :as cph]
|
||||||
[app.common.spec :as us]
|
[app.common.spec :as us]
|
||||||
[app.common.text :as txt]
|
[app.common.text :as txt]
|
||||||
[app.common.uuid :as uuid]
|
|
||||||
[app.config :as cf]
|
[app.config :as cf]
|
||||||
[app.main.data.events :as ev]
|
[app.main.data.events :as ev]
|
||||||
[app.main.data.modal :as modal]
|
[app.main.data.modal :as modal]
|
||||||
|
@ -182,7 +181,7 @@
|
||||||
|
|
||||||
(defn- create-assets-group
|
(defn- create-assets-group
|
||||||
[rename components-to-group group-name]
|
[rename components-to-group group-name]
|
||||||
(let [undo-id (uuid/next)]
|
(let [undo-id (js/Symbol)]
|
||||||
(st/emit! (dwu/start-undo-transaction undo-id))
|
(st/emit! (dwu/start-undo-transaction undo-id))
|
||||||
(apply st/emit!
|
(apply st/emit!
|
||||||
(->> components-to-group
|
(->> components-to-group
|
||||||
|
@ -594,7 +593,7 @@
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps @state)
|
(mf/deps @state)
|
||||||
(fn []
|
(fn []
|
||||||
(let [undo-id (uuid/next)]
|
(let [undo-id (js/Symbol)]
|
||||||
(if (empty? selected-components)
|
(if (empty? selected-components)
|
||||||
(st/emit! (dwl/duplicate-component {:id (:component-id @state)}))
|
(st/emit! (dwl/duplicate-component {:id (:component-id @state)}))
|
||||||
(do
|
(do
|
||||||
|
@ -606,7 +605,7 @@
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps @state file-id multi-components? multi-assets?)
|
(mf/deps @state file-id multi-components? multi-assets?)
|
||||||
(fn []
|
(fn []
|
||||||
(let [undo-id (uuid/next)]
|
(let [undo-id (js/Symbol)]
|
||||||
(if (or multi-components? multi-assets?)
|
(if (or multi-components? multi-assets?)
|
||||||
(on-assets-delete)
|
(on-assets-delete)
|
||||||
(st/emit! (dwu/start-undo-transaction undo-id)
|
(st/emit! (dwu/start-undo-transaction undo-id)
|
||||||
|
@ -653,7 +652,7 @@
|
||||||
(mf/deps components selected-components on-clear-selection)
|
(mf/deps components selected-components on-clear-selection)
|
||||||
(fn [group-name]
|
(fn [group-name]
|
||||||
(on-clear-selection)
|
(on-clear-selection)
|
||||||
(let [undo-id (uuid/next)]
|
(let [undo-id (js/Symbol)]
|
||||||
(st/emit! (dwu/start-undo-transaction undo-id))
|
(st/emit! (dwu/start-undo-transaction undo-id))
|
||||||
(apply st/emit!
|
(apply st/emit!
|
||||||
(->> components
|
(->> components
|
||||||
|
@ -670,7 +669,7 @@
|
||||||
(mf/deps components)
|
(mf/deps components)
|
||||||
(fn [path last-path]
|
(fn [path last-path]
|
||||||
(on-clear-selection)
|
(on-clear-selection)
|
||||||
(let [undo-id (uuid/next)]
|
(let [undo-id (js/Symbol)]
|
||||||
(st/emit! (dwu/start-undo-transaction undo-id))
|
(st/emit! (dwu/start-undo-transaction undo-id))
|
||||||
(apply st/emit!
|
(apply st/emit!
|
||||||
(->> components
|
(->> components
|
||||||
|
@ -701,7 +700,7 @@
|
||||||
(mf/deps components)
|
(mf/deps components)
|
||||||
(fn [path]
|
(fn [path]
|
||||||
(on-clear-selection)
|
(on-clear-selection)
|
||||||
(let [undo-id (uuid/next)]
|
(let [undo-id (js/Symbol)]
|
||||||
(st/emit! (dwu/start-undo-transaction undo-id))
|
(st/emit! (dwu/start-undo-transaction undo-id))
|
||||||
(apply st/emit!
|
(apply st/emit!
|
||||||
(->> components
|
(->> components
|
||||||
|
@ -1029,7 +1028,7 @@
|
||||||
(mf/deps objects selected-objects on-clear-selection)
|
(mf/deps objects selected-objects on-clear-selection)
|
||||||
(fn [group-name]
|
(fn [group-name]
|
||||||
(on-clear-selection)
|
(on-clear-selection)
|
||||||
(let [undo-id (uuid/next)]
|
(let [undo-id (js/Symbol)]
|
||||||
(st/emit! (dwu/start-undo-transaction undo-id))
|
(st/emit! (dwu/start-undo-transaction undo-id))
|
||||||
(apply st/emit!
|
(apply st/emit!
|
||||||
(->> objects
|
(->> objects
|
||||||
|
@ -1046,7 +1045,7 @@
|
||||||
(mf/deps objects)
|
(mf/deps objects)
|
||||||
(fn [path last-path]
|
(fn [path last-path]
|
||||||
(on-clear-selection)
|
(on-clear-selection)
|
||||||
(let [undo-id (uuid/next)]
|
(let [undo-id (js/Symbol)]
|
||||||
(st/emit! (dwu/start-undo-transaction undo-id))
|
(st/emit! (dwu/start-undo-transaction undo-id))
|
||||||
(apply st/emit!
|
(apply st/emit!
|
||||||
(->> objects
|
(->> objects
|
||||||
|
@ -1076,7 +1075,7 @@
|
||||||
(mf/deps objects)
|
(mf/deps objects)
|
||||||
(fn [path]
|
(fn [path]
|
||||||
(on-clear-selection)
|
(on-clear-selection)
|
||||||
(let [undo-id (uuid/next)]
|
(let [undo-id (js/Symbol)]
|
||||||
(st/emit! (dwu/start-undo-transaction undo-id))
|
(st/emit! (dwu/start-undo-transaction undo-id))
|
||||||
(apply st/emit!
|
(apply st/emit!
|
||||||
(->> objects
|
(->> objects
|
||||||
|
@ -1193,7 +1192,7 @@
|
||||||
(fn []
|
(fn []
|
||||||
(if (or multi-colors? multi-assets?)
|
(if (or multi-colors? multi-assets?)
|
||||||
(on-assets-delete)
|
(on-assets-delete)
|
||||||
(let [undo-id (uuid/next)]
|
(let [undo-id (js/Symbol)]
|
||||||
(st/emit! (dwu/start-undo-transaction undo-id)
|
(st/emit! (dwu/start-undo-transaction undo-id)
|
||||||
(dwl/delete-color color)
|
(dwl/delete-color color)
|
||||||
(dwl/sync-file file-id file-id :colors (:id color))
|
(dwl/sync-file file-id file-id :colors (:id color))
|
||||||
|
@ -1458,7 +1457,7 @@
|
||||||
(fn [color-id]
|
(fn [color-id]
|
||||||
(fn [group-name]
|
(fn [group-name]
|
||||||
(on-clear-selection)
|
(on-clear-selection)
|
||||||
(let [undo-id (uuid/next)]
|
(let [undo-id (js/Symbol)]
|
||||||
(st/emit! (dwu/start-undo-transaction undo-id))
|
(st/emit! (dwu/start-undo-transaction undo-id))
|
||||||
(apply st/emit!
|
(apply st/emit!
|
||||||
(->> colors
|
(->> colors
|
||||||
|
@ -1476,7 +1475,7 @@
|
||||||
(mf/deps colors)
|
(mf/deps colors)
|
||||||
(fn [path last-path]
|
(fn [path last-path]
|
||||||
(on-clear-selection)
|
(on-clear-selection)
|
||||||
(let [undo-id (uuid/next)]
|
(let [undo-id (js/Symbol)]
|
||||||
(st/emit! (dwu/start-undo-transaction undo-id))
|
(st/emit! (dwu/start-undo-transaction undo-id))
|
||||||
(apply st/emit!
|
(apply st/emit!
|
||||||
(->> colors
|
(->> colors
|
||||||
|
@ -1508,7 +1507,7 @@
|
||||||
(mf/deps colors)
|
(mf/deps colors)
|
||||||
(fn [path]
|
(fn [path]
|
||||||
(on-clear-selection)
|
(on-clear-selection)
|
||||||
(let [undo-id (uuid/next)]
|
(let [undo-id (js/Symbol)]
|
||||||
(st/emit! (dwu/start-undo-transaction undo-id))
|
(st/emit! (dwu/start-undo-transaction undo-id))
|
||||||
(apply st/emit!
|
(apply st/emit!
|
||||||
(->> colors
|
(->> colors
|
||||||
|
@ -1757,7 +1756,7 @@
|
||||||
(mf/deps typographies selected-typographies on-clear-selection file-id)
|
(mf/deps typographies selected-typographies on-clear-selection file-id)
|
||||||
(fn [group-name]
|
(fn [group-name]
|
||||||
(on-clear-selection)
|
(on-clear-selection)
|
||||||
(let [undo-id (uuid/next)]
|
(let [undo-id (js/Symbol)]
|
||||||
(st/emit! (dwu/start-undo-transaction undo-id))
|
(st/emit! (dwu/start-undo-transaction undo-id))
|
||||||
(apply st/emit!
|
(apply st/emit!
|
||||||
(->> typographies
|
(->> typographies
|
||||||
|
@ -1775,7 +1774,7 @@
|
||||||
(mf/deps typographies)
|
(mf/deps typographies)
|
||||||
(fn [path last-path]
|
(fn [path last-path]
|
||||||
(on-clear-selection)
|
(on-clear-selection)
|
||||||
(let [undo-id (uuid/next)]
|
(let [undo-id (js/Symbol)]
|
||||||
(st/emit! (dwu/start-undo-transaction undo-id))
|
(st/emit! (dwu/start-undo-transaction undo-id))
|
||||||
(apply st/emit!
|
(apply st/emit!
|
||||||
(->> typographies
|
(->> typographies
|
||||||
|
@ -1806,7 +1805,7 @@
|
||||||
(mf/deps typographies)
|
(mf/deps typographies)
|
||||||
(fn [path]
|
(fn [path]
|
||||||
(on-clear-selection)
|
(on-clear-selection)
|
||||||
(let [undo-id (uuid/next)]
|
(let [undo-id (js/Symbol)]
|
||||||
(st/emit! (dwu/start-undo-transaction undo-id))
|
(st/emit! (dwu/start-undo-transaction undo-id))
|
||||||
(apply st/emit!
|
(apply st/emit!
|
||||||
(->> typographies
|
(->> typographies
|
||||||
|
@ -1844,7 +1843,7 @@
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps @state multi-typographies? multi-assets?)
|
(mf/deps @state multi-typographies? multi-assets?)
|
||||||
(fn []
|
(fn []
|
||||||
(let [undo-id (uuid/next)]
|
(let [undo-id (js/Symbol)]
|
||||||
(if (or multi-typographies? multi-assets?)
|
(if (or multi-typographies? multi-assets?)
|
||||||
(on-assets-delete)
|
(on-assets-delete)
|
||||||
(st/emit! (dwu/start-undo-transaction undo-id)
|
(st/emit! (dwu/start-undo-transaction undo-id)
|
||||||
|
@ -2088,7 +2087,7 @@
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps selected-assets)
|
(mf/deps selected-assets)
|
||||||
(fn []
|
(fn []
|
||||||
(let [undo-id (uuid/next)]
|
(let [undo-id (js/Symbol)]
|
||||||
(st/emit! (dwu/start-undo-transaction undo-id))
|
(st/emit! (dwu/start-undo-transaction undo-id))
|
||||||
(apply st/emit! (map #(dwl/delete-component {:id %})
|
(apply st/emit! (map #(dwl/delete-component {:id %})
|
||||||
(:components selected-assets)))
|
(:components selected-assets)))
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
[app.common.geom.shapes :as gsh]
|
[app.common.geom.shapes :as gsh]
|
||||||
[app.common.types.shape.layout :as ctl]
|
[app.common.types.shape.layout :as ctl]
|
||||||
[app.common.types.shape.radius :as ctsr]
|
[app.common.types.shape.radius :as ctsr]
|
||||||
[app.common.uuid :as uuid]
|
|
||||||
[app.main.constants :refer [size-presets]]
|
[app.main.constants :refer [size-presets]]
|
||||||
[app.main.data.workspace :as udw]
|
[app.main.data.workspace :as udw]
|
||||||
[app.main.data.workspace.changes :as dch]
|
[app.main.data.workspace.changes :as dch]
|
||||||
|
@ -250,7 +249,7 @@
|
||||||
(mf/deps ids)
|
(mf/deps ids)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(let [value (-> event dom/get-target dom/checked?)
|
(let [value (-> event dom/get-target dom/checked?)
|
||||||
undo-id (uuid/next)]
|
undo-id (js/Symbol)]
|
||||||
(do
|
(do
|
||||||
(st/emit! (dwu/start-undo-transaction undo-id)
|
(st/emit! (dwu/start-undo-transaction undo-id)
|
||||||
(dch/update-shapes ids (fn [shape] (assoc shape :hide-in-viewer (not value)))))
|
(dch/update-shapes ids (fn [shape] (assoc shape :hide-in-viewer (not value)))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue