浏览代码

fix: display tags for blocks too

Tienson Qin 2 年之前
父节点
当前提交
11ad914f27
共有 1 个文件被更改,包括 21 次插入18 次删除
  1. 21 18
      src/main/frontend/components/block.cljs

+ 21 - 18
src/main/frontend/components/block.cljs

@@ -2282,11 +2282,12 @@
 
 
 (rum/defc tags
 (rum/defc tags
   [config block]
   [config block]
-  [:div.flex.flex-row.flex-wrap.items-center.ml-4.gap-1
-   (for [tag (:block/tags block)]
-     (page-cp (assoc config
-                     :tag? true
-                     :disable-preview? true) tag))])
+  (when (seq (:block/tags block))
+    [:div.flex.flex-row.flex-wrap.items-center.ml-4.gap-1
+     (for [tag (:block/tags block)]
+       (page-cp (assoc config
+                       :tag? true
+                       :disable-preview? true) tag))]))
 
 
 (rum/defc block-content < rum/reactive
 (rum/defc block-content < rum/reactive
   [config {:block/keys [uuid content properties scheduled deadline format pre-block?] :as block} edit-input-id block-id slide? selected?]
   [config {:block/keys [uuid content properties scheduled deadline format pre-block?] :as block} edit-input-id block-id slide? selected?]
@@ -2340,19 +2341,21 @@
          "Large block will not be editable or searchable to not slow down the app, please use another editor to edit this block."])
          "Large block will not be editable or searchable to not slow down the app, please use another editor to edit this block."])
       [:div.flex.flex-row.justify-between.block-content-inner
       [:div.flex.flex-row.justify-between.block-content-inner
        (when-not plugin-slotted?
        (when-not plugin-slotted?
-         [:div.flex-1.w-full
-          (cond
-            (:block/name block)
-            [:div.flex.flex-1.flex-row.flex-wrap.justify-between.items-center
-             (page-cp config block)
-             (when (seq (:block/tags block))
-               (tags config block))]
-
-            (or (seq title) (:block/marker block))
-            (build-block-title config block)
-
-            :else
-            nil)])
+         (let [block-tags (:block/tags block)]
+           [:div.flex-1.w-full
+            [:div.flex.flex-1.w-full.flex-row.flex-wrap.justify-between.items-center
+             (cond
+               (:block/name block)
+               (page-cp config block)
+
+               (or (seq title) (:block/marker block))
+               (build-block-title config block)
+
+               :else
+               nil)
+
+             (when (seq block-tags)
+               (tags config block))]]))
 
 
        (clock-summary-cp block body)]
        (clock-summary-cp block body)]