Jelajahi Sumber

Adds :outliner/block-title-collapse-enabled? configuration option

Tienson Qin 3 tahun lalu
induk
melakukan
fc644e207b
2 mengubah file dengan 13 tambahan dan 4 penghapusan
  1. 5 3
      src/main/frontend/handler/editor.cljs
  2. 8 1
      templates/config.edn

+ 5 - 3
src/main/frontend/handler/editor.cljs

@@ -3385,9 +3385,11 @@
        (and
         (not (util/collapsed? block))
         (or (db-model/has-children? block-id)
-            (block-with-title? (:block/format block)
-                               (:block/content block)
-                               semantic?)))
+            (and
+             (:outliner/block-title-collapse-enabled? (state/get-config))
+             (block-with-title? (:block/format block)
+                                (:block/content block)
+                                semantic?))))
        false))))
 
 (defn all-blocks-with-level

+ 8 - 1
templates/config.edn

@@ -1,5 +1,5 @@
 {:meta/version 1
- 
+
  ;; Currently, we support either "Markdown" or "Org".
  ;; This can overwrite your global preference so that
  ;; maybe your personal preferred format is Org but you'd
@@ -144,6 +144,13 @@
  :commands
  []
 
+ ;; By default, a block can only be collapsed if it has some children.
+ ;; `:outliner/block-title-collapse-enabled? true` enables a block with a title
+ ;; (multiple lines) can be collapsed too. For example:
+ ;; - block title
+ ;;   block content
+ :outliner/block-title-collapse-enabled? false
+
  ;; Macros replace texts and will make you more productive.
  ;; For example:
  ;; Add this to the macros below: