0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-02 12:28:54 -05:00

🐛 Fix undo/redo in grid editor

This commit is contained in:
alonso.torres 2023-12-04 11:00:50 +01:00 committed by Andrey Antukh
parent fc1db9b985
commit f3cd384e8e
2 changed files with 8 additions and 8 deletions

View file

@ -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)))]

View file

@ -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