diff --git a/CHANGES.md b/CHANGES.md index 660104c6b..bb0184553 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -17,8 +17,8 @@ - Fix problem with rules position on changing pages [Taiga #4847](https://tree.taiga.io/project/penpot/issue/4847) - Fix error streen when uploading wrong SVG [#2995](https://github.com/penpot/penpot/issues/2995) -- Fix error streen when uploading wrong SVG [#2995](https://github.com/penpot/penpot/issues/2995) - Fix selecting children from hidden parent layers [Taiga #4934](https://tree.taiga.io/project/penpot/issue/4934) +- Fix problem when undoing multiple selected colors [Taiga #4920](https://tree.taiga.io/project/penpot/issue/4920) ### :arrow_up: Deps updates diff --git a/frontend/src/app/main/data/workspace/colors.cljs b/frontend/src/app/main/data/workspace/colors.cljs index abe3bd8ac..c63ec6f6a 100644 --- a/frontend/src/app/main/data/workspace/colors.cljs +++ b/frontend/src/app/main/data/workspace/colors.cljs @@ -16,6 +16,7 @@ [app.main.data.workspace.libraries :as dwl] [app.main.data.workspace.state-helpers :as wsh] [app.main.data.workspace.texts :as dwt] + [app.main.data.workspace.undo :as dwu] [app.util.color :as uc] [beicon.core :as rx] [potok.core :as ptk])) @@ -350,14 +351,18 @@ (ptk/reify ::change-color-in-selected ptk/WatchEvent (watch [_ _ _] - (->> (rx/from shapes-by-color) - (rx/map (fn [shape] (case (:prop shape) - :fill (change-fill [(:shape-id shape)] new-color (:index shape)) - :stroke (change-stroke [(:shape-id shape)] new-color (:index shape)) - :shadow (change-shadow [(:shape-id shape)] new-color (:index shape)) - :content (dwt/update-text-with-function - (:shape-id shape) - (partial change-text-color old-color new-color (:index shape)))))))))) + (let [undo-id (js/Symbol)] + (rx/concat + (rx/of (dwu/start-undo-transaction undo-id)) + (->> (rx/from shapes-by-color) + (rx/map (fn [shape] (case (:prop shape) + :fill (change-fill [(:shape-id shape)] new-color (:index shape)) + :stroke (change-stroke [(:shape-id shape)] new-color (:index shape)) + :shadow (change-shadow [(:shape-id shape)] new-color (:index shape)) + :content (dwt/update-text-with-function + (:shape-id shape) + (partial change-text-color old-color new-color (:index shape))))))) + (rx/of (dwu/commit-undo-transaction undo-id))))))) (defn apply-color-from-palette [color is-alt?]