浏览代码

fix(electron): initial warning of local dir

Andelf 2 年之前
父节点
当前提交
72a290d21c

+ 1 - 1
deps/common/src/logseq/common/path.cljs

@@ -154,7 +154,7 @@
 
   (cond
     (nil? base)
-    (js/console.error "path join global directory" segments)
+    (js/console.log "path join global directory" segments)
     (= base "")
     (js/console.error "BUG: should not join with empty dir" segments)
     :else

+ 0 - 1
deps/graph-parser/src/logseq/graph_parser/config.cljs

@@ -30,7 +30,6 @@
 
 (defn remove-asset-protocol
   [s]
-  (js/console.error "BUG: remove-asset-protocol")
   (if (local-protocol-asset? s)
     (-> s
         (string/replace-first asset-protocol "")

+ 2 - 1
src/electron/electron/utils.cljs

@@ -261,7 +261,8 @@
 (defn get-graph-dir
   "required by all internal state in the electron section"
   [graph-name]
-  (string/replace graph-name "logseq_local_" ""))
+  (when (string/includes? graph-name "logseq_local_")
+    (string/replace-first graph-name "logseq_local_" "")))
 
 (defn get-graph-name
   "reversing `get-graph-dir`"

+ 2 - 1
src/main/frontend/core.cljs

@@ -52,7 +52,8 @@
     (rum/mount (page/current-page) node)
     (display-welcome-message)
     ;; NO repo state here, better not add init logic here
-    ))
+    (when config/dev?
+      (js/setTimeout #(sync/<sync-start) 1000))))
 
 (defn ^:export init []
   ;; init is called ONCE when the page loads

+ 0 - 2
src/main/frontend/handler.cljs

@@ -238,8 +238,6 @@
    (when (util/electron?)
      (el/listen!))
    (persist-var/load-vars)
-   (when config/dev?
-     (js/setTimeout #(sync/<sync-start) 1000))
    (js/setTimeout instrument! (* 60 1000))))
 
 (defn stop! []

+ 1 - 2
src/main/frontend/handler/editor.cljs

@@ -1458,10 +1458,9 @@
     (let [repo      (state/get-current-repo)
           repo-dir  (config/get-repo-dir repo)
           ;; Hack for path calculation
-          path      (str "./" (string/replace path "../" "/"))
+          path      (string/replace path #"^(\\.\\.)?/" "./")
           full-path (path/path-join repo-dir path)
           data-url? (string/starts-with? path "data:")]
-      (prn ::make-asset-url full-path path)
       (cond
         data-url?
         path ;; just return the original

+ 0 - 1
src/main/frontend/state.cljs

@@ -798,7 +798,6 @@ Similar to re-frame subscriptions"
 
 (defn set-current-repo!
   [repo]
-  (prn ::set-current-rep repo)
   (swap! state assoc :git/current-repo repo)
   (if repo
     (storage/set :git/current-repo repo)