Jelajahi Sumber

Add option to show full block body in ref

Sergio Miguéns Iglesias 3 tahun lalu
induk
melakukan
e58e545248

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

@@ -872,7 +872,7 @@
           stop-inner-events? (= block-type :whiteboard-shape)]
       (if (and block (:block/content block))
         (let [title [:span.block-ref
-                     (block-content (assoc config :block-ref? true :stop-events? stop-inner-events?)
+                     (block-content (assoc config :block-ref? (not (state/show-full-blocks?)) :stop-events? stop-inner-events?)
                                     block nil (:block/uuid block)
                                     (:slide? config))]
               inner (if label

+ 8 - 0
src/main/frontend/components/settings.cljs

@@ -366,6 +366,12 @@
           logical-outdenting?
           config-handler/toggle-logical-outdenting!))
 
+(defn showing-full-blocks [t show-full-blocks?]
+  (toggle "show_full_blocks"
+          (t :settings-page/show-full-blocks)
+          show-full-blocks?
+          config-handler/toggle-show-full-blocks!))
+
 (defn preferred-pasting-file [t preferred-pasting-file?]
   (toggle "preferred_pasting_file"
           (t :settings-page/preferred-pasting-file)
@@ -607,6 +613,7 @@
         enable-timetracking? (state/enable-timetracking?)
         enable-all-pages-public? (state/all-pages-public?)
         logical-outdenting? (state/logical-outdenting?)
+        show-full-blocks? (state/show-full-blocks?)
         preferred-pasting-file? (state/preferred-pasting-file?)
         enable-tooltip? (state/enable-tooltip?)
         enable-shortcut-tooltip? (state/sub :ui/shortcut-tooltip?)
@@ -622,6 +629,7 @@
 
      (when (util/electron?) (switch-spell-check-row t))
      (outdenting-row t logical-outdenting?)
+     (showing-full-blocks t show-full-blocks?)
      (preferred-pasting-file t preferred-pasting-file?)
      (when-not (or (util/mobile?) (mobile-util/native-platform?))
        (shortcut-tooltip-row t enable-shortcut-tooltip?))

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

@@ -220,6 +220,7 @@
         :settings-page/disable-sentry "Send usage data and diagnostics to Logseq"
         :settings-page/disable-sentry-desc "Logseq will never collect your local graph database or sell your data." 
         :settings-page/preferred-outdenting "Logical outdenting"
+        :settings-page/show-full-blocks "Show full blocks"
         :settings-page/custom-date-format "Preferred date format"
         :settings-page/custom-date-format-warning "Re-index required! Existing journal references would be broken!"
         :settings-page/preferred-file-format "Preferred file format"
@@ -2346,6 +2347,7 @@
         :settings-page/auto-updater "Auto actualizador"
         :settings-page/disable-sentry "Enviar datos de uso y diagnósticos a Logseq"
         :settings-page/preferred-outdenting "Disminución lógica de sangría"
+        :settings-page/show-full-blocks "Enseñar bloques completos"
         :settings-page/custom-date-format "Formato de fecha preferido"
         :settings-page/preferred-file-format "Formato de archivo preferido"
         :settings-page/preferred-workflow "Flujo de trabajo preferido"

+ 4 - 0
src/main/frontend/handler/config.cljs

@@ -44,6 +44,10 @@
   (let [logical-outdenting? (state/logical-outdenting?)]
     (set-config! :editor/logical-outdenting? (not logical-outdenting?))))
 
+(defn toggle-show-full-blocks! []
+  (let [show-full-blocks? (state/show-full-blocks?)]
+    (set-config! :ui/show-full-blocks? (not show-full-blocks?))))
+
 (defn toggle-ui-enable-tooltip! []
   (let [enable-tooltip? (state/enable-tooltip?)]
     (set-config! :ui/enable-tooltip? (not enable-tooltip?))))

+ 1 - 0
src/main/frontend/schema/handler/common_config.cljc

@@ -38,6 +38,7 @@
     [:block/content-max-length :int]
     [:ui/show-command-doc? :boolean]
     [:ui/show-empty-bullets? :boolean]
+    [:ui/show-full-blocks? :boolean]
     [:query/views [:map-of
                    :keyword
                    [:sequential any?]]]

+ 4 - 0
src/main/frontend/state.cljs

@@ -670,6 +670,10 @@ Similar to re-frame subscriptions"
   []
   (:editor/logical-outdenting? (sub-config)))
 
+(defn show-full-blocks?
+  []
+  (:ui/show-full-blocks? (sub-config)))
+
 (defn preferred-pasting-file?
   []
   (:editor/preferred-pasting-file? (sub-config)))

+ 3 - 0
templates/config.edn

@@ -27,6 +27,9 @@
  ;; Show brackets around page references
  ;; :ui/show-brackets? true
 
+ ;; Enable showing the body of blocks when referencing them.
+ :ui/show-full-blocks? false
+
  ;; Enable Block timestamp
  :feature/enable-block-timestamps? false