mirror of
https://github.com/penpot/penpot.git
synced 2025-06-05 23:31:38 +02:00
🐛 Fix undo/redo in grid editor
This commit is contained in:
parent
fc1db9b985
commit
f3cd384e8e
2 changed files with 8 additions and 8 deletions
|
@ -103,9 +103,11 @@
|
||||||
(ptk/reify ::redo
|
(ptk/reify ::redo
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [it state _]
|
(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)]
|
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)
|
(let [undo (:workspace-undo state)
|
||||||
items (:items undo)
|
items (:items undo)
|
||||||
index (or (:index undo) (dec (count items)))]
|
index (or (:index undo) (dec (count items)))]
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
(:require
|
(:require
|
||||||
[app.main.data.shortcuts :as ds]
|
[app.main.data.shortcuts :as ds]
|
||||||
[app.main.data.workspace :as dw]
|
[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]
|
[app.main.store :as st]
|
||||||
[beicon.core :as rx]
|
[beicon.core :as rx]
|
||||||
[potok.core :as ptk]))
|
[potok.core :as ptk]))
|
||||||
|
@ -32,19 +32,17 @@
|
||||||
(rx/empty))))))
|
(rx/empty))))))
|
||||||
|
|
||||||
(def shortcuts
|
(def shortcuts
|
||||||
{
|
{:escape {:tooltip (ds/esc)
|
||||||
|
|
||||||
:escape {:tooltip (ds/esc)
|
|
||||||
:command ["escape" "enter" "v"]
|
:command ["escape" "enter" "v"]
|
||||||
:fn #(st/emit! (esc-pressed))}
|
:fn #(st/emit! (esc-pressed))}
|
||||||
|
|
||||||
:undo {:tooltip (ds/meta "Z")
|
:undo {:tooltip (ds/meta "Z")
|
||||||
:command (ds/c-mod "z")
|
:command (ds/c-mod "z")
|
||||||
:fn #(st/emit! (drp/undo-path))}
|
:fn #(st/emit! dwc/undo)}
|
||||||
|
|
||||||
:redo {:tooltip (ds/meta "Y")
|
:redo {:tooltip (ds/meta "Y")
|
||||||
:command [(ds/c-mod "shift+z") (ds/c-mod "y")]
|
:command [(ds/c-mod "shift+z") (ds/c-mod "y")]
|
||||||
:fn #(st/emit! (drp/redo-path))}
|
:fn #(st/emit! dwc/redo)}
|
||||||
|
|
||||||
;; ZOOM
|
;; ZOOM
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue