improve(custom.css): support import current graph assets file

This commit is contained in:
charlie
2022-08-11 17:18:15 +08:00
committed by Tienson Qin
parent 9d9d8b3474
commit 24595cc4a9
2 changed files with 11 additions and 1 deletions

View File

@@ -373,6 +373,15 @@
(get-file-path repo
(str app-name "/" export-css-file)))))
(defn expand-relative-assets-path
;; ../assets/xxx -> {assets|file}://{current-graph-root-path}/xxx
[source]
(when-let [protocol (and (string? source)
(not (string/blank? source))
(if (util/electron?) "assets" "file"))]
(string/replace
source "../assets" (util/format "%s://%s/assets" protocol (get-repo-dir (state/get-current-repo))))))
(defn get-custom-js-path
([]

View File

@@ -125,7 +125,8 @@
[]
(when-let [style (or
(state/get-custom-css-link)
(db-model/get-custom-css)
(some-> (db-model/get-custom-css)
(config/expand-relative-assets-path))
;; (state/get-custom-css-link)
)]
(util/add-style! style)))