Przeglądaj źródła

fix: /draw command not working with GitHub repos

Tienson Qin 5 lat temu
rodzic
commit
d3ff3a1000

+ 3 - 1
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?

+ 4 - 4
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))))))))

+ 7 - 7
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<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