瀏覽代碼

fix: favorited block doesn't display reference correctly

fixes https://linear.app/logseq/issue/LOG-3214/favorited-block-doesnt-display-reference-correctly
Tienson Qin 1 年之前
父節點
當前提交
39d0cc80ba
共有 2 個文件被更改,包括 28 次插入16 次删除
  1. 23 16
      src/main/frontend/components/container.cljs
  2. 5 0
      src/main/frontend/components/container.css

+ 23 - 16
src/main/frontend/components/container.cljs

@@ -13,6 +13,7 @@
             [frontend.components.dnd :as dnd-component]
             [frontend.components.icon :as icon]
             [frontend.components.handbooks :as handbooks]
+            [frontend.components.block :as block]
             [dommy.core :as d]
             [frontend.components.content :as cp-content]
             [frontend.components.title :as title]
@@ -118,23 +119,29 @@
                              (x-menu-shortcut (shortcut-utils/decorate-binding "shift+click")))]))]
 
     ;; TODO: move to standalone component
-    [:a.flex.items-center.justify-between.relative.group
-     {:title (title/block-unique-title page)
-      :on-click
-      (fn [e]
-        (if (gobj/get e "shiftKey")
-          (open-in-sidebar)
-          (route-handler/redirect-to-page! (:block/uuid page) {:click-from-recent? recent?})))
-      :on-context-menu (fn [^js e]
-                         (shui/popup-show! e (x-menu-content)
-                                           {:as-dropdown? true
-                                            :content-props {:on-click (fn [] (shui/popup-hide!))
-                                                            :class "w-60"}})
-                         (util/stop e))}
+    [:a.flex.items-center.justify-between.relative.group.h-6
+     (cond->
+      {:on-click
+       (fn [e]
+         (if (gobj/get e "shiftKey")
+           (open-in-sidebar)
+           (route-handler/redirect-to-page! (:block/uuid page) {:click-from-recent? recent?})))
+       :on-context-menu (fn [^js e]
+                          (shui/popup-show! e (x-menu-content)
+                                            {:as-dropdown? true
+                                             :content-props {:on-click (fn [] (shui/popup-hide!))
+                                                             :class "w-60"}})
+                          (util/stop e))}
+       (db/page? page)
+       (assoc :title (title/block-unique-title page)))
      [:span.page-icon.ml-3.justify-center (if whiteboard-page? (ui/icon "whiteboard" {:extension? true}) icon)]
-     [:span.page-title {:class (when untitled? "opacity-50")}
-      (if untitled? (t :untitled)
-          (pdf-utils/fix-local-asset-pagename title))]
+     [:span.page-title {:class (when untitled? "opacity-50")
+                        :style {:display "ruby"}}
+      (cond
+        (not (db/page? page))
+        (block/inline-text :markdown (:block/title page))
+        untitled? (t :untitled)
+        :else (pdf-utils/fix-local-asset-pagename title))]
 
      ;; dots trigger
      (shui/button

+ 5 - 0
src/main/frontend/components/container.css

@@ -837,3 +837,8 @@ html[data-theme='dark'] {
 .blocks-selection-mode .page-title, .blocks-selection-mode .block-content-inner, .blocks-selection-mode .block-body, .blocks-selection-mode .ls-properties-area {
     user-select: none;
 }
+
+.favorite-item {
+    @apply overflow-hidden;
+    max-height: 24px;
+}