From b77e8856d8392eb6910dca548943f99b31dd1416 Mon Sep 17 00:00:00 2001 From: charlie Date: Mon, 27 Dec 2021 16:13:39 +0800 Subject: [PATCH] fix: passed route link when opening external url with ui button cp --- src/main/frontend/util.cljc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/frontend/util.cljc b/src/main/frontend/util.cljc index ba2606a04..758bb39e7 100644 --- a/src/main/frontend/util.cljc +++ b/src/main/frontend/util.cljc @@ -1550,6 +1550,9 @@ #?(:cljs (defn open-url [url] - (if (electron?) - (js/window.apis.openExternal url) - (set! (.-href js/window.location) url)))) \ No newline at end of file + (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))))) \ No newline at end of file