Просмотр исходного кода

fix: raw file save not working

Tienson Qin 4 лет назад
Родитель
Сommit
fa66ecc72c
1 измененных файлов с 7 добавлено и 3 удалено
  1. 7 3
      src/main/frontend/handler/editor/lifecycle.cljs

+ 7 - 3
src/main/frontend/handler/editor/lifecycle.cljs

@@ -78,9 +78,13 @@
               (if (and journal? new-name (not= old-page-name (string/lower-case new-name)))
               (if (and journal? new-name (not= old-page-name (string/lower-case new-name)))
                 (notification/show! "Journal title can't be changed." :warning)
                 (notification/show! "Journal title can't be changed." :warning)
                 (let [new-name (if journal? (date/journal-title->default new-name) new-name)
                 (let [new-name (if journal? (date/journal-title->default new-name) new-name)
-                      new-path (if (= (string/lower-case new-name) (string/lower-case old-page-name))
-                                 path
-                                 (page-handler/compute-new-file-path path new-name))]
+                      new-path (if new-name
+                                (if (and
+                                     new-name old-page-name
+                                     (= (string/lower-case new-name) (string/lower-case old-page-name)))
+                                  path
+                                  (page-handler/compute-new-file-path path new-name))
+                                path)]
                   (file/alter-file (state/get-current-repo) new-path (string/trim value)
                   (file/alter-file (state/get-current-repo) new-path (string/trim value)
                                    {:re-render-root? true})))))))
                                    {:re-render-root? true})))))))
       (when-not (contains? #{:insert :indent-outdent :auto-save} (state/get-editor-op))
       (when-not (contains? #{:insert :indent-outdent :auto-save} (state/get-editor-op))