mirror of https://github.com/logseq/logseq
fix: images from github repos can't be displayed
parent
102e68a07a
commit
f9f819a566
|
@ -241,7 +241,8 @@
|
|||
nil
|
||||
(safe-read-string metadata false))
|
||||
title (second (first label))]
|
||||
(if (config/local-asset? href)
|
||||
(if (and (config/local-asset? href)
|
||||
(config/local-db? (state/get-current-repo)))
|
||||
(asset-link config title href label metadata full_text)
|
||||
(let [href (if (util/starts-with? href "http")
|
||||
href
|
||||
|
|
|
@ -57,8 +57,14 @@
|
|||
(protocol/rmdir! (get-fs dir) dir))
|
||||
|
||||
(defn read-file
|
||||
[dir path]
|
||||
(protocol/read-file (get-fs dir) dir path))
|
||||
([dir path]
|
||||
(let [fs (get-fs dir)
|
||||
options (if (= fs bfs-record)
|
||||
{:encoding "utf8"}
|
||||
{})]
|
||||
(read-file dir path {})))
|
||||
([dir path options]
|
||||
(protocol/read-file (get-fs dir) dir path options)))
|
||||
|
||||
(defn write-file!
|
||||
[repo dir path content opts]
|
||||
|
|
|
@ -22,9 +22,8 @@
|
|||
(p/rejected "Unlinking a directory is not allowed")))))
|
||||
(rmdir! [this dir]
|
||||
(js/window.workerThread.rimraf dir))
|
||||
(read-file [this dir path]
|
||||
(let [option (clj->js {:encoding "utf8"})]
|
||||
(js/window.pfs.readFile (str dir "/" path) option)))
|
||||
(read-file [this dir path options]
|
||||
(js/window.pfs.readFile (str dir "/" path) (clj->js options)))
|
||||
(write-file! [this repo dir path content opts]
|
||||
(when-not (util/electron?)
|
||||
(js/window.pfs.writeFile (str dir "/" path) content)))
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
(rmdir! [this dir]
|
||||
nil)
|
||||
|
||||
(read-file [this dir path]
|
||||
(read-file [this dir path options]
|
||||
(let [handle-path (str "handle" dir "/" path)]
|
||||
(p/let [handle (idb/get-item handle-path)
|
||||
local-file (and handle (.getFile handle))]
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
(ipc/ipc "unlink" path))
|
||||
(rmdir! [this dir]
|
||||
nil)
|
||||
(read-file [this dir path]
|
||||
(read-file [this dir path _options]
|
||||
(let [path (concat-path dir path)]
|
||||
(ipc/ipc "readFile" path)))
|
||||
(write-file! [this repo dir path content _opts]
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
(readdir [this dir])
|
||||
(unlink! [this path opts])
|
||||
(rmdir! [this dir])
|
||||
(read-file [this dir path])
|
||||
(read-file [this dir path opts])
|
||||
(write-file! [this repo dir path content opts])
|
||||
(rename! [this repo old-path new-path])
|
||||
(stat [this dir path])
|
||||
|
|
|
@ -37,7 +37,8 @@
|
|||
path)]
|
||||
(util/p-handle
|
||||
(fs/read-file (config/get-repo-dir (state/get-current-repo))
|
||||
path)
|
||||
path
|
||||
{})
|
||||
(fn [blob]
|
||||
(let [blob (js/Blob. (array blob) (clj->js {:type "image"}))
|
||||
img-url (image/create-object-url blob)]
|
||||
|
|
Loading…
Reference in New Issue