fix: href asset is not loaded on Electron

This commit is contained in:
Junyi Du
2022-11-10 00:05:41 +08:00
committed by Tienson Qin
parent fb283f7bbb
commit 77ff2515b8
2 changed files with 16 additions and 6 deletions

View File

@@ -197,10 +197,8 @@
asset-path (gp-config/remove-asset-protocol src)]
(if (string/blank? asset-path)
(reset! *exist? false)
(-> (fs/file-exists? "" asset-path)
(p/then
(fn [exist?]
(reset! *exist? (boolean exist?))))))
(p/let [exist? (fs/file-or-href-exists? "" asset-path)]
(reset! *exist? (boolean exist?))))
(assoc state ::asset-path asset-path ::asset-file? true))
state)))
:will-update (fn [state]
@@ -314,8 +312,10 @@
:title title}
metadata)]
[:.asset-overlay]
(let [image-src (string/replace src #"^assets://" "")]
(let [image-src (string/replace src #"^assets://" "")
_ (prn "image-src:" image-src)]
[:.asset-action-bar {:aria-hidden "true"}
;; the image path bar
(when (util/electron?)
[:button.asset-action-btn.text-left
{:title (t (if local? :asset/show-in-folder :asset/open-in-browser))