enhance(mobile): display img

This commit is contained in:
Weihua Lu
2021-09-28 12:30:55 +08:00
committed by Tienson Qin
parent 0afd15c23d
commit 1d3ed88716
2 changed files with 12 additions and 3 deletions

View File

@@ -48,7 +48,8 @@
[lambdaisland.glogi :as log]
[medley.core :as medley]
[promesa.core :as p]
["/frontend/utils" :as utils]))
["/frontend/utils" :as utils]
[frontend.mobile.util :as mobile]))
;; FIXME: should support multiple images concurrently uploading
@@ -1478,8 +1479,15 @@
[path] ;; path start with "/assets" or compatible for "../assets"
(let [repo-dir (config/get-repo-dir (state/get-current-repo))
path (string/replace path "../" "/")]
(if (util/electron?)
(cond
(util/electron?)
(str "assets://" repo-dir path)
(mobile/is-native-platform?)
(mobile/convert-file-src
(str "file://" repo-dir path))
:else
(let [handle-path (str "handle" repo-dir path)
cached-url (get @*assets-url-cache (keyword handle-path))]
(if cached-url