Sfoglia il codice sorgente

enhance: Add option to show full blocks in references

adds the option to allow references to show more than the block title, for those of use who like them more than embeds and don't want the block's children included in our refs.

Idea from discussion: #7928
Bad3r 2 anni fa
parent
commit
b8db41ea53

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

@@ -2245,7 +2245,7 @@
         plugin-slotted? (and config/lsp-enabled? (state/slot-hook-exist? uuid))
         block-ref? (:block-ref? config)
         stop-events? (:stop-events? config)
-        block-ref-with-title? (and block-ref? (seq title))
+        block-ref-with-title? (and block-ref? (not (state/show-full-blocks?)) (seq title))
         block-type (or (:ls-type properties) :default)
         content (if (string? content) (string/trim content) "")
         mouse-down-key (if (util/ios?)

+ 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 all lines of a block reference"
         :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 "Mostrar todas las líneas de una referencia a bloque"
         :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