瀏覽代碼

CSS tweaks

Tienson Qin 1 年之前
父節點
當前提交
02fcc69928

+ 3 - 3
deps/outliner/src/logseq/outliner/property.cljs

@@ -445,11 +445,11 @@
 
 (defn block-has-viewable-properties?
   [block-entity]
-  (let [properties (:block/properties block-entity)]
+  (let [properties (->> (keys (:block/properties block-entity))
+                        (remove #{:logseq.property/icon :logseq.property/built-in?}))]
     (or
      (seq (:block/alias block-entity))
-     (and (seq properties)
-          (not= properties [:logseq.property/icon])))))
+     (seq properties))))
 
 (defn- build-closed-value-tx
   [db property property-type resolved-value {:keys [id icon description]

+ 8 - 15
src/main/frontend/components/db_based/page.cljs

@@ -22,22 +22,14 @@
    be displaying properties from both components at the same time"
   < rum/reactive
   [page {:keys [mode configure?]}]
-  (let [class? (= mode :class)
-        edit-input-id-prefix (str "edit-block-" (:block/uuid page))
+  (let [edit-input-id-prefix (str "edit-block-" (:block/uuid page))
         configure-opts {:selected? false
                         :page-configure? configure?}
         has-viewable-properties? (outliner-property/block-has-viewable-properties? page)
-        has-class-properties? (seq (:class/schema.properties page))
         hide-properties? (:logseq.property/hide-properties? page)]
-    (when (or configure?
-              (and
-               (not hide-properties?)
-               (or has-viewable-properties?
-                   has-class-properties?)))
+    (when (or configure? (and (not hide-properties?) has-viewable-properties?))
       [:div.ls-page-properties
-       {:class (util/classnames [{:no-properties (if class?
-                                                   (not has-class-properties?)
-                                                   (not has-viewable-properties?))}])}
+       {:class (util/classnames [{:no-properties (not has-viewable-properties?)}])}
        (if configure?
          (cond
            (= mode :class)
@@ -52,10 +44,11 @@
                                              (str edit-input-id-prefix "-page")
                                              (assoc configure-opts :class-schema? false :page? true)))
          ;; default view for page-inner
-         (component-block/db-properties-cp {:editor-box editor/box}
-                                           page
-                                           (str edit-input-id-prefix "-page")
-                                           (assoc configure-opts :class-schema? false :page? true)))])))
+         [:div.ml-1.mb-4
+          (component-block/db-properties-cp {:editor-box editor/box}
+                                            page
+                                            (str edit-input-id-prefix "-page")
+                                            (assoc configure-opts :class-schema? false :page? true))])])))
 
 (rum/defc tags
   [page]

+ 3 - 3
src/main/frontend/components/page.cljs

@@ -533,7 +533,7 @@
 
             (when (and db-based? (not block?) (:block/tags page))
               [:div.cursor-pointer
-               {:class (if sidebar? "ml-6" "ml-1")}
+               {:class (if sidebar? "ml-6" "ml-2")}
                (db-page/tags page)])
 
             (cond
@@ -553,10 +553,10 @@
                  [:div.mb-4
                   (component-block/breadcrumb config repo block-id {:level-limit 3})]))
 
-             (when (and db-based? (not block?) (not preview?) (not (::show-page-info? state)))
+             (when (and db-based? (not block?) (not preview?) (not @(::show-page-info? state)))
                (db-page/page-properties-react page {:configure? false}))
 
-                   ;; blocks
+             ;; blocks
              (page-blocks-cp repo page {:sidebar? sidebar? :whiteboard? whiteboard?})]])
 
          (when today?

+ 8 - 16
src/main/frontend/components/property.cljs

@@ -499,22 +499,14 @@
 
 (rum/defcs new-property < rum/reactive
   [state block opts]
-  (when-not (:in-block-container? opts)
+  (when (and (:page-configure? opts) (not config/publishing?))
     [:div.ls-new-property
-     (cond
-       (and (or (outliner-property/block-has-viewable-properties? block)
-                (:page-configure? opts))
-            (not config/publishing?)
-            (not (:in-block-container? opts)))
-       [:a.fade-link.flex.add-property
-        {:on-click (fn []
-                     (state/pub-event! [:editor/new-property (merge opts {:block block})]))}
-        [:div.flex.flex-row.items-center {:style {:padding-left 1}}
-         (ui/icon "plus" {:size 15})
-         [:div.ml-2.text-sm "Add property"]]]
-
-       :else
-       [:div {:style {:height 28}}])]))
+     [:a.fade-link.flex.add-property
+      {:on-click (fn []
+                   (state/pub-event! [:editor/new-property (merge opts {:block block})]))}
+      [:div.flex.flex-row.items-center {:style {:padding-left 1}}
+       (ui/icon "plus" {:size 15})
+       [:div.ml-1.text-sm "Add property"]]]]))
 
 (defn- property-collapsed?
   [block property]
@@ -769,7 +761,7 @@
                                (ldb/built-in? ent))
                           ;; other position
                           (when-not (or (and (:sidebar? opts) (= (:id opts) (str (:block/uuid block))))
-                                        (= (str (:block/uuid block)) (str (state/get-current-page))))
+                                        (ldb/page? block))
                             (outliner-property/property-with-other-position? ent)))))))
                   properties))
         {:keys [classes all-classes classes-properties]} (outliner-property/get-block-classes-properties (db/get-db) (:db/id block))