From f3cd384e8eb53836acd4cf9b7fb8f5ec5760d0e0 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 4 Dec 2023 11:00:50 +0100 Subject: [PATCH] :bug: Fix undo/redo in grid editor --- frontend/src/app/main/data/workspace/common.cljs | 6 ++++-- .../app/main/data/workspace/grid_layout/shortcuts.cljs | 10 ++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/frontend/src/app/main/data/workspace/common.cljs b/frontend/src/app/main/data/workspace/common.cljs index a5791ea6d..994a0d0de 100644 --- a/frontend/src/app/main/data/workspace/common.cljs +++ b/frontend/src/app/main/data/workspace/common.cljs @@ -103,9 +103,11 @@ (ptk/reify ::redo ptk/WatchEvent (watch [it state _] - (let [edition (get-in state [:workspace-local :edition]) + (let [objects (wsh/lookup-page-objects state) + edition (get-in state [:workspace-local :edition]) drawing (get state :workspace-drawing)] - (when (and (nil? edition) (or (empty? drawing) (= :curve (:tool drawing)))) + (when (and (or (nil? edition) (ctl/grid-layout? objects edition)) + (or (empty? drawing) (= :curve (:tool drawing)))) (let [undo (:workspace-undo state) items (:items undo) index (or (:index undo) (dec (count items)))] diff --git a/frontend/src/app/main/data/workspace/grid_layout/shortcuts.cljs b/frontend/src/app/main/data/workspace/grid_layout/shortcuts.cljs index 5cb77ac72..d003186a8 100644 --- a/frontend/src/app/main/data/workspace/grid_layout/shortcuts.cljs +++ b/frontend/src/app/main/data/workspace/grid_layout/shortcuts.cljs @@ -8,7 +8,7 @@ (:require [app.main.data.shortcuts :as ds] [app.main.data.workspace :as dw] - [app.main.data.workspace.path :as drp] + [app.main.data.workspace.common :as dwc] [app.main.store :as st] [beicon.core :as rx] [potok.core :as ptk])) @@ -32,19 +32,17 @@ (rx/empty)))))) (def shortcuts - { - - :escape {:tooltip (ds/esc) + {:escape {:tooltip (ds/esc) :command ["escape" "enter" "v"] :fn #(st/emit! (esc-pressed))} :undo {:tooltip (ds/meta "Z") :command (ds/c-mod "z") - :fn #(st/emit! (drp/undo-path))} + :fn #(st/emit! dwc/undo)} :redo {:tooltip (ds/meta "Y") :command [(ds/c-mod "shift+z") (ds/c-mod "y")] - :fn #(st/emit! (drp/redo-path))} + :fn #(st/emit! dwc/redo)} ;; ZOOM