Browse Source

fix: don't jump to new journal when in editing mode

Tienson Qin 4 years ago
parent
commit
ce8ca500bb
2 changed files with 6 additions and 1 deletions
  1. 2 1
      src/main/frontend/handler/repo.cljs
  2. 4 0
      src/main/frontend/state.cljs

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

@@ -143,7 +143,8 @@
            (when-not file-exists?
              (file-handler/reset-file! repo-url path content)
              (p/let [_ (fs/create-if-not-exists repo-url repo-dir file-path content)]
-               (ui-handler/re-render-root!)
+               (when-not (state/editing?)
+                 (ui-handler/re-render-root!))
                (git-handler/git-add repo-url path)))))))))
 
 (defn create-today-journal!

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

@@ -370,6 +370,10 @@
   []
   (ffirst (:editor/editing? @state)))
 
+(defn editing?
+  []
+  (some? (get-edit-input-id)))
+
 (defn get-edit-content
   []
   (get (:editor/content @state) (get-edit-input-id)))