mirror of
https://github.com/penpot/penpot.git
synced 2025-01-25 07:58:49 -05:00
🎉 Add previous screen action
This commit is contained in:
parent
ed380c86eb
commit
4697a1904a
4 changed files with 30 additions and 0 deletions
|
@ -26,6 +26,7 @@
|
|||
[app.main.ui.shapes.text :as text]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.object :as obj]
|
||||
[app.util.router :as rt]
|
||||
[app.util.timers :as tm]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
|
@ -65,6 +66,10 @@
|
|||
(:frame-id shape)))]
|
||||
(st/emit! (dv/close-overlay frame-id)))
|
||||
|
||||
:prev-screen
|
||||
(do
|
||||
(st/emit! (rt/nav-back-local)))
|
||||
|
||||
nil))
|
||||
|
||||
;; Perform the opposite action of an interaction, if possible
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
(get destination :name (tr "workspace.options.interaction-none")))
|
||||
:close-overlay (tr "workspace.options.interaction-close-overlay-dest"
|
||||
(get destination :name (tr "workspace.options.interaction-self")))
|
||||
:prev-screen (tr "workspace.options.interaction-prev-screen")
|
||||
"--"))
|
||||
|
||||
(defn- overlay-pos-type-names
|
||||
|
|
|
@ -94,6 +94,14 @@
|
|||
|
||||
:close-overlay "M -5 -5 L 5 5 M -5 5 L 5 -5"
|
||||
|
||||
:prev-screen (case arrow-dir
|
||||
:left "M -6.5 0 l 12 0 l -6 -6 m 6 6 l -6 6"
|
||||
:right "M 6.5 0 l -12 0 l 6 -6 m -6 6 l 6 6"
|
||||
nil)
|
||||
|
||||
:open-url (str "M1 -5 L 3 -7 L 7 -3 L 1 3 L -1 1"
|
||||
"M-1 5 L -3 7 L -7 3 L -1 -3 L 1 -1")
|
||||
|
||||
nil)
|
||||
inv-zoom (/ 1 zoom)]
|
||||
[:*
|
||||
|
|
|
@ -132,6 +132,22 @@
|
|||
|
||||
(js/window.open (str uri) name)))))
|
||||
|
||||
(defn nav-back
|
||||
[]
|
||||
(ptk/reify ::nav-back
|
||||
ptk/EffectEvent
|
||||
(effect [_ _ _]
|
||||
(ts/asap #(.back (.-history js/window))))))
|
||||
|
||||
(defn nav-back-local
|
||||
"Navigate back only if the previous page is in penpot app."
|
||||
[]
|
||||
(let [location (.-location js/document)
|
||||
referrer (u/uri (.-referrer js/document))]
|
||||
(when (or (nil? (:host referrer))
|
||||
(= (.-hostname location) (:host referrer)))
|
||||
(nav-back))))
|
||||
|
||||
;; --- History API
|
||||
|
||||
(defn initialize-history
|
||||
|
|
Loading…
Add table
Reference in a new issue