fix: /draw command not working with GitHub repos

pull/1283/head
Tienson Qin 2021-02-05 22:27:27 +08:00
parent 50cb2d282c
commit d3ff3a1000
3 changed files with 14 additions and 12 deletions

View File

@ -132,7 +132,9 @@
format (-> (util/get-file-ext path)
(config/get-file-format))
pending-writes (state/get-write-chan-length)]
(if (and local-content old-content new?
(if (and local-content (or old-content
;; temporally fix
(and path (string/ends-with? path ".excalidraw"))) new?
(or
(> pending-writes 0)
not-changed?

View File

@ -67,10 +67,10 @@
(git-handler/git-add repo path)
(ok-handler file)
(db/transact! repo
[{:file/path path}
{:page/name file
:page/file path
:page/journal? false}]))
[{:file/path path
:page/name file
:page/file [:file/path path]
:page/journal? false}]))
(p/catch (fn [error]
(prn "Write file failed, path: " path ", data: " data)
(js/console.dir error))))))))

View File

@ -1636,12 +1636,12 @@
(reset! *asset-uploading? false)
(reset! *asset-uploading-process 0))))
(image/upload
files
(fn [file file-name file-type]
files
(fn [file file-name file-type]
(image-handler/request-presigned-url
file file-name file-type
uploading?
(fn [signed-url]
file file-name file-type
uploading?
(fn [signed-url]
(insert-command! id
(get-asset-file-link format signed-url file-name true)
format
@ -1650,7 +1650,7 @@
(reset! *asset-uploading? false)
(reset! *asset-uploading-process 0))
(fn [e]
(fn [e]
(let [process (* (/ (gobj/get e "loaded")
(gobj/get e "total"))
100)]
@ -2139,7 +2139,7 @@
(when-not (string/blank? (:title m))
(let [file (draw/title->file-name (:title m))
value (util/format
"[[%s]]\n<iframe class=\"draw-iframe\" src=\"/draw?file=%s\" width=\"100%\" height=\"400\" frameborder=\"0\" allowfullscreen></iframe>"
"[[%s]]\n<iframe class=\"draw-iframe\" src=\"/#/draw?file=%s\" width=\"100%\" height=\"400\" frameborder=\"0\" allowfullscreen></iframe>"
file
file)]
(insert-command! id