ソースを参照

Fix icon property and update property related fixmes

Gabriel Horner 2 年 前
コミット
358987d7b3

+ 2 - 1
deps/db/src/logseq/db/property.cljs

@@ -59,7 +59,8 @@
                             :visible true}
 
    :icon {:original-name "Icon"
-          :schema {:type :map}}
+          :schema {:type :default}
+          :visible true}
    :public {:schema {:type :checkbox :hide? true}
             :visible true}
    :filters {:schema {:type :map}}

+ 1 - 0
deps/publishing/src/logseq/publishing/db.cljs

@@ -124,6 +124,7 @@
                                    (not (string/ends-with? path ".js")))
                           path)))))
           ;; area image assets
+          ;; FIXME: Lookup by property uuid
           (and
            (= :block/properties (:a datom))
            (= (keyword (get (:v datom) :hl-type)) :area))

+ 1 - 2
src/main/frontend/components/page.cljs

@@ -592,11 +592,10 @@
           whiteboard? (:whiteboard? option) ;; in a whiteboard portal shape?
           whiteboard-page? (model/whiteboard-page? page-name) ;; is this page a whiteboard?
           route-page-name path-page-name
-          {:keys [icon]} (:block/properties page)
+          icon (or (pu/lookup (:block/properties page) :icon) "")
           page-name (:block/name page)
           page-original-name (:block/original-name page)
           title (or page-original-name page-name)
-          icon (or icon "")
           today? (and
                   journal?
                   (= page-name (util/page-name-sanity-lc (date/journal-name))))

+ 1 - 0
src/main/frontend/components/query_table.cljs

@@ -24,6 +24,7 @@
 ;; ========
 (defn- attach-clock-property
   [result]
+  ;; FIXME: Look up by property id if still supporting clock-time
   (let [ks [:block/properties :clock-time]
         result (map (fn [b]
                       (let [b (block/parse-title-and-body b)]

+ 3 - 2
src/main/frontend/components/right_sidebar.cljs

@@ -22,7 +22,8 @@
             [reitit.frontend.easy :as rfe]
             [rum.core :as rum]
             [frontend.handler.common :as common-handler]
-            [frontend.db.rtc.debug-ui :as rtc-debug-ui]))
+            [frontend.db.rtc.debug-ui :as rtc-debug-ui]
+            [frontend.handler.property.util :as pu]))
 
 (rum/defc toggle
   []
@@ -148,7 +149,7 @@
           page (db/entity repo lookup)
           page-name (:block/name page)]
       [[:.flex.items-center.page-title
-        (if-let [icon (get-in page [:block/properties :icon])]
+        (if-let [icon (pu/lookup (:block/properties page) :icon)]
           [:.text-md.mr-2 icon]
           (ui/icon (if (= "whiteboard" (:block/type page)) "whiteboard" "page") {:class "text-md mr-2"}))
         [:span.overflow-hidden.text-ellipsis (db-model/get-page-original-name page-name)]]

+ 0 - 1
src/main/frontend/db/model.cljs

@@ -267,7 +267,6 @@ independent of format as format specific heading characters are stripped"
            second
            string/lower-case))
 
-;; FIXME: replace :heading with id
 (defn get-block-by-page-name-and-block-route-name
   "Returns first block for given page name and block's route name. Block's route
   name must match the content of a page's block header"