fix: passed route link when opening external url with ui button cp

pull/3585/head^2
charlie 2021-12-27 16:13:39 +08:00 committed by Andelf
parent 539672afeb
commit b77e8856d8
1 changed files with 6 additions and 3 deletions

View File

@ -1550,6 +1550,9 @@
#?(:cljs
(defn open-url
[url]
(if (electron?)
(js/window.apis.openExternal url)
(set! (.-href js/window.location) url))))
(let [route? (or (string/starts-with? url
(string/replace js/location.href js/location.hash ""))
(string/starts-with? url "#"))]
(if (and (not route?) (electron?))
(js/window.apis.openExternal url)
(set! (.-href js/window.location) url)))))