From 013f56347de94e22e21d3b2bedb3ca7b2e05c465 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Tue, 5 Oct 2021 10:45:02 +0200 Subject: [PATCH] :bug: Fix undo problem when changing typography/color --- CHANGES.md | 1 + frontend/src/app/main/data/workspace/libraries.cljs | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 8049dd416..735b893ab 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -13,6 +13,7 @@ - Fix problem with overflow dropdown on stroke-cap [#1216](https://github.com/penpot/penpot/issues/1216) - Fix menu context for single element nested in components [#1186](https://github.com/penpot/penpot/issues/1186) - Fix error screen when operations over comments fail [#1219](https://github.com/penpot/penpot/issues/1219) +- Fix undo problem when changing typography/color from library [#1230](https://github.com/penpot/penpot/issues/1230) ### :arrow_up: Deps updates ### :boom: Breaking changes diff --git a/frontend/src/app/main/data/workspace/libraries.cljs b/frontend/src/app/main/data/workspace/libraries.cljs index 4e4e0444b..9ba3a9a79 100644 --- a/frontend/src/app/main/data/workspace/libraries.cljs +++ b/frontend/src/app/main/data/workspace/libraries.cljs @@ -19,6 +19,7 @@ [app.main.data.workspace.groups :as dwg] [app.main.data.workspace.libraries-helpers :as dwlh] [app.main.data.workspace.state-helpers :as wsh] + [app.main.data.workspace.undo :as dwu] [app.main.repo :as rp] [app.main.store :as st] [app.util.i18n :refer [tr]] @@ -134,10 +135,12 @@ :color color} uchg {:type :mod-color :color prev}] - (rx/of (dch/commit-changes {:redo-changes [rchg] + (rx/of (dwu/start-undo-transaction) + (dch/commit-changes {:redo-changes [rchg] :undo-changes [uchg] :origin it}) - (sync-file (:current-file-id state) file-id)))))) + (sync-file (:current-file-id state) file-id) + (dwu/commit-undo-transaction)))))) (defn delete-color [{:keys [id] :as params}] @@ -244,10 +247,12 @@ :typography typography} uchg {:type :mod-typography :typography prev}] - (rx/of (dch/commit-changes {:redo-changes [rchg] + (rx/of (dwu/start-undo-transaction) + (dch/commit-changes {:redo-changes [rchg] :undo-changes [uchg] :origin it}) - (sync-file (:current-file-id state) file-id)))))) + (sync-file (:current-file-id state) file-id) + (dwu/commit-undo-transaction)))))) (defn delete-typography [id]