Browse Source

enhance: add some docs for Contents

Tienson Qin 4 years ago
parent
commit
8fd7e0cbbe

+ 2 - 2
resources/css/common.css

@@ -98,9 +98,9 @@ html[data-theme=light] {
   --ls-secondary-text-color: #161e2e;
   --ls-title-text-color: var(--ls-primary-text-color);
   --ls-link-text-color: #106BA3;
-  --ls-link-text-hover-color: #5d9cd6;
+  --ls-link-text-hover-color: #1a537c;
   --ls-link-ref-text-color: #106BA3;
-  --ls-link-ref-text-hover-color: #5d9cd6;
+  --ls-link-ref-text-hover-color: #1a537c;
   --ls-tag-text-color: var(--ls-link-ref-text-color);
   --ls-tag-text-hover-color: var(--ls-link-ref-text-hover-color);
   --ls-slide-background-color: #fff;

+ 3 - 12
src/main/frontend/components/block.cljs

@@ -1114,18 +1114,9 @@
             (when-not slide? marker-switch)
             marker-cp
             priority]
-           (cond
-             dummy?
-             [[:span.opacity-50 "Click here to start writing"]]
-
-             ;; empty item
-             (and contents? (or
-                             (empty? title)
-                             (= title [["Plain" "[[]]"]])))
-             [[:span.opacity-50 "Click here to add a page, e.g. [[favorite-page]]"]]
-
-             :else
-             (map-inline config title))
+           (if title
+             (map-inline config title)
+             [[:span.opacity-50 "Click here to start writing"]])
            [tags])))))))
 
 (defn dnd-same-block?

+ 1 - 1
src/main/frontend/components/header.cljs

@@ -82,7 +82,7 @@
           :options {:on-click state/toggle-sidebar-open?!}})
 
        (when current-repo
-         {:title (t :graph)
+         {:title (t :graph-view)
           :options {:href (rfe/href :graph)}
           :icon svg/graph-sm})
 

+ 21 - 11
src/main/frontend/components/page.cljs

@@ -294,22 +294,26 @@
                        (not sidebar?)
                        (not config/publishing?))
 
-              (let [links (->>
-                           [(when file
-                              {:title (t :page/re-index)
-                               :options {:on-click (fn []
-                                                     (file/re-index! file))}})
-                            {:title (t :page/add-to-contents)
-                             :options {:on-click (fn [] (page-handler/handle-add-page-to-contents! page-original-name))}}
-                            {:title (t :page/rename)
-                             :options {:on-click #(state/set-modal! (rename-page-dialog page-name))}}
+              (let [contents? (= (string/lower-case (str page-name)) "contents")
+                    links (->>
+                           [(when-not contents?
+                              {:title (t :page/add-to-contents)
+                               :options {:on-click (fn [] (page-handler/handle-add-page-to-contents! page-original-name))}})
+
+                            (when-not contents?
+                              {:title (t :page/rename)
+                               :options {:on-click #(state/set-modal! (rename-page-dialog page-name))}})
+
                             (when (and file-path (util/electron?))
                               [{:title   (t :page/open-in-finder)
                                 :options {:on-click #(js/window.apis.showItemInFolder file-path)}}
                                {:title (t :page/open-with-default-app)
                                 :options {:on-click #(js/window.apis.openPath file-path)}}])
-                            {:title (t :page/delete)
-                             :options {:on-click #(state/set-modal! (delete-page-dialog page-name))}}
+
+                            (when-not contents?
+                              {:title (t :page/delete)
+                               :options {:on-click #(state/set-modal! (delete-page-dialog page-name))}})
+
                             {:title   (t :page/action-publish)
                              :options {:on-click
                                        (fn []
@@ -342,6 +346,12 @@
                                                                             page-name
                                                                             (if public? false true))
                                                                            (state/close-modal!))}}])])))}}
+
+                            (when file
+                              {:title (t :page/re-index)
+                               :options {:on-click (fn []
+                                                     (file/re-index! file))}})
+
                             (when developer-mode?
                               {:title "(Dev) Show page data"
                                :options {:on-click (fn []

+ 4 - 2
src/main/frontend/components/reference.cljs

@@ -54,7 +54,8 @@
 
           (ui/foldable
            [:h2.font-bold.opacity-50 (let []
-                                       (str n-ref " Linked References"))]
+                                       (str n-ref " Linked Reference"
+                                            (if (> n-ref 1) "s")))]
            [:div.references-blocks
             (let [ref-hiccup (block/->hiccup ref-blocks
                                              {:id page-name
@@ -98,7 +99,8 @@
           (ui/foldable
            [:h2.font-bold {:style {:opacity "0.3"}}
             (if @n-ref
-              (str @n-ref " Unlinked References")
+              (str @n-ref " Unlinked Reference" (if (> @n-ref 1)
+                                                  "s"))
               "Unlinked References")]
            (fn [] (unlinked-references-aux page-name n-ref))
            true)]]))))

+ 4 - 3
src/main/frontend/components/search.cljs

@@ -229,7 +229,8 @@
 
                           nil))})])))
 
-(rum/defc search < rum/reactive
+(rum/defcs search < rum/reactive
+  (rum/local false ::inside-box?)
   (mixins/event-mixin
    (fn [state]
      (mixins/hide-when-esc-or-outside
@@ -237,7 +238,7 @@
       :on-hide (fn []
                  (search-handler/clear-search!)
                  (leave-focus)))))
-  []
+  [state]
   (let [search-result (state/sub :search/result)
         search-q (state/sub :search/q)
         show-result? (boolean (seq search-result))]
@@ -271,7 +272,7 @@
                               (reset! search-timeout
                                       (js/setTimeout
                                        #(search-handler/search value)
-                                       500))))))}]
+                                       100))))))}]
          (when-not (string/blank? search-q)
            (ui/css-transition
             {:class-names "fade"

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

@@ -315,6 +315,7 @@ title: How to take dummy notes?
         :new-page "New page"
         :new-file "New file"
         :graph "Graph"
+        :graph-view "View Graph"
         :publishing "Publishing"
         :export "Export public pages"
         :all-graphs "All graphs"
@@ -1035,6 +1036,7 @@ title: How to take dummy notes?
            :new-page "新页面"
            :new-file "新文件"
            :graph "图谱"
+           :graph-view "全局图谱"
            :publishing "发布"
            :export "导出公开页面"
            :all-graphs "所有库"

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

@@ -76,7 +76,12 @@
                   "/contents."
                   (config/get-file-extension format))
         file-path (str "/" path)
-        default-content (util/default-content-with-title format "contents")]
+        default-content (case (name format)
+                          "org"
+                          "** What's **Contents**?\n*** It's a normal page called [[Contents]], you can use it for:\n**** 1. table of content/index/MOC\n**** 2. pinning/bookmarking favorites pages/blocks (e.g. [[Logseq]])\n**** 3. You can also put many different things, depending on your personal workflow."
+                          "markdown"
+                          "## What's **Contents**?\n### It's a normal page called [[Contents]], you can use it for:\n#### 1. table of content/index/MOC\n#### 2. pinning/bookmarking favorites pages/blocks (e.g. [[Logseq]])\n#### 3. You can also put many different things, depending on your personal workflow."
+                          "")]
     (p/let [_ (fs/mkdir-if-not-exists (str repo-dir "/" (state/get-pages-directory)))
             file-exists? (fs/create-if-not-exists repo-url repo-dir file-path default-content)]
       (when-not file-exists?

+ 2 - 0
src/main/frontend/util.cljc

@@ -997,8 +997,10 @@
          new-block (case (name text-format)
                      "org"
                      "** "
+
                      "markdown"
                      "## "
+
                      "")]
      (if contents?
        new-block