mirror of
https://github.com/penpot/penpot.git
synced 2025-07-31 00:08:31 +02:00
🎉 Add previous screen action
This commit is contained in:
parent
ed380c86eb
commit
4697a1904a
4 changed files with 30 additions and 0 deletions
|
@ -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
Add a link
Reference in a new issue