Browse Source

feat: add show-command-doc? config

Junyu Zhan 4 years ago
parent
commit
9e3c197d8e
3 changed files with 10 additions and 2 deletions
  1. 1 1
      src/main/frontend/components/editor.cljs
  2. 7 1
      src/main/frontend/state.cljs
  3. 2 0
      templates/config.edn

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

@@ -42,7 +42,7 @@
           (fn [item]
             (let [command-name (first item)
                   command-doc (get item 2)]
-              [:div {:title command-doc} command-name]))
+              [:div {:title (when (state/show-command-doc?) command-doc)} command-name]))
 
           :on-chosen
           (fn [chosen-item]

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

@@ -429,7 +429,7 @@
      ;;                        (remove #(= leader-parent %)))]
      ;;     (prn "followers: " (count followers))
      ;;     ))
-)))
+     )))
 
 (defn get-edit-input-id
   []
@@ -1060,6 +1060,12 @@
        :ui/enable-tooltip?
        true))
 
+(defn show-command-doc?
+  []
+  (get (get (sub-config) (get-current-repo))
+       :ui/show-command-doc?
+       true))
+
 (defn set-config!
   [repo-url value]
   (set-state! [:config repo-url] value))

+ 2 - 0
templates/config.edn

@@ -96,6 +96,8 @@
  ;;  :editor/down            ["ctrl+j" "down"]
  ;;  :editor/left            ["ctrl+h" "left"]
  ;;  :editor/right           ["ctrl+l" "right"]}
+ ;; Whether to show command doc on hover
+ :ui/show-command-doc? true
 
  ;; The app will show those queries in today's journal page,
  ;; the "NOW" query asks the tasks which need to be finished "now",