From d3ff3a10003892a936c10f06ce8b1c1c99696441 Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Fri, 5 Feb 2021 22:27:27 +0800 Subject: [PATCH] fix: /draw command not working with GitHub repos --- src/main/frontend/fs/nfs.cljs | 4 +++- src/main/frontend/handler/draw.cljs | 8 ++++---- src/main/frontend/handler/editor.cljs | 14 +++++++------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/main/frontend/fs/nfs.cljs b/src/main/frontend/fs/nfs.cljs index f24df9b08..8f826d84d 100644 --- a/src/main/frontend/fs/nfs.cljs +++ b/src/main/frontend/fs/nfs.cljs @@ -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? diff --git a/src/main/frontend/handler/draw.cljs b/src/main/frontend/handler/draw.cljs index 6f7a57e32..3e23d1d33 100644 --- a/src/main/frontend/handler/draw.cljs +++ b/src/main/frontend/handler/draw.cljs @@ -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)))))))) diff --git a/src/main/frontend/handler/editor.cljs b/src/main/frontend/handler/editor.cljs index d3444f78b..ab810d96e 100644 --- a/src/main/frontend/handler/editor.cljs +++ b/src/main/frontend/handler/editor.cljs @@ -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" + "[[%s]]\n" file file)] (insert-command! id