1
0
Эх сурвалжийг харах

refactor: don't create properties for new pages

Tienson Qin 4 жил өмнө
parent
commit
4f6809768b

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

@@ -185,4 +185,4 @@
       (el/listen!))))
       (el/listen!))))
 
 
 (defn stop! []
 (defn stop! []
-  (shortcut/uninstall-shortcuts!))
+  (prn "stop!"))

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

@@ -119,7 +119,7 @@
            format (state/get-preferred-format repo-url)
            format (state/get-preferred-format repo-url)
            title (date/today)
            title (date/today)
            file-name (date/journal-title->default title)
            file-name (date/journal-title->default title)
-           default-content (util/default-content-with-title format title false)
+           default-content (util/default-content-with-title format)
            template (state/get-journal-template)
            template (state/get-journal-template)
            template (if (and template
            template (if (and template
                              (not (string/blank? template)))
                              (not (string/blank? template)))
@@ -132,7 +132,7 @@
                      (str default-content template)
                      (str default-content template)
 
 
                      :else
                      :else
-                     (util/default-content-with-title format title true))
+                     default-content)
            path (str config/default-journals-directory "/" file-name "."
            path (str config/default-journals-directory "/" file-name "."
                      (config/get-file-extension format))
                      (config/get-file-extension format))
            file-path (str "/" path)
            file-path (str "/" path)

+ 6 - 18
src/main/frontend/util.cljc

@@ -1057,24 +1057,12 @@
     keyboard-shortcut))
     keyboard-shortcut))
 
 
 (defn default-content-with-title
 (defn default-content-with-title
-  ([text-format title]
-   (default-content-with-title text-format title true))
-  ([text-format title new-block?]
-   (let [contents? (= (string/lower-case title) "contents")
-         properties (case (name text-format)
-                      "org"
-                      (format "#+TITLE: %s" title)
-                      "markdown"
-                      (format "---\ntitle: %s\n---" title)
-                      "")
-         new-block (case (name text-format)
-                     "org"
-                     "* "
-
-                     "- ")]
-     (if contents?
-       new-block
-       (str properties "\n\n" (if new-block? new-block))))))
+  [text-format]
+  (case (name text-format)
+    "org"
+    "* "
+
+    "- "))
 
 
 #?(:cljs
 #?(:cljs
     (defn get-first-block-by-id
     (defn get-first-block-by-id