From 61a6232bd4f04f169472e0a708fe6d16f5dafdca Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Mon, 7 Aug 2023 21:12:21 +0800 Subject: [PATCH] fix: avoid circle block ref --- src/main/frontend/components/property.cljs | 35 ++++++++++------------ src/main/frontend/components/property.css | 2 -- src/main/frontend/handler/editor.cljs | 2 ++ 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/src/main/frontend/components/property.cljs b/src/main/frontend/components/property.cljs index 391e828e09..cfa965ee72 100644 --- a/src/main/frontend/components/property.cljs +++ b/src/main/frontend/components/property.cljs @@ -218,6 +218,7 @@ (defn- select-block [block property opts] (let [blocks (->> (model/get-all-block-contents) + (remove (fn [b] (= (:db/id block) (:db/id b)))) (map (fn [b] (assoc b :value (:block/content b)))))] (select/select {:items blocks @@ -463,19 +464,17 @@ [:div#edit-new-property (property-input block *property-key *property-value opts)] - (or (and (seq properties) - (not (pu/all-built-in-properties? (keys (:block/properties block))))) - (:page-configure? opts)) - [:a {:style {:margin-left 2} - :title "Add another property" - :on-click (fn [] - (property-handler/set-editing-new-property! edit-input-id) - (reset! *property-key nil) - (reset! *property-value nil))} - [:div.block {:style {:height 20 - :width 20}} - [:a.add-button-link.block.mt-1 {:style {:margin-left -4}} - (ui/icon "circle-plus")]]]))) + (or (:page-configure? opts) + (and (seq properties) + (not (pu/all-built-in-properties? (keys (:block/properties block)))))) + [:div + [:a.add-button-link + {:title "Add another property" + :on-click (fn [] + (property-handler/set-editing-new-property! edit-input-id) + (reset! *property-key nil) + (reset! *property-value nil))} + (ui/icon "circle-plus" {:size 15})]]))) (rum/defcs property-key [state block property {:keys [class-schema?]}] @@ -572,11 +571,9 @@ :else [:div.rounded-sm.ml-1 {:on-click (fn [] (reset! *editing? true))} [:div.flex.flex-row - [:div.block {:style {:height 20 - :width 20}} - [:a.add-button-link.block {:title "Add another value" - :style {:margin-left -4}} - (ui/icon "circle-plus")]]]])]) + [:a.add-button-link.inline-flex {:title "Add another value" + :style {:margin-left -3}} + (ui/icon "circle-plus")]]])]) :else [:div.flex.flex-1.items-center.property-value-content @@ -645,6 +642,6 @@ (if (:class-schema? opts) [:div.property-description.col-span-3.font-light (get-in property [:block/schema :description])] - [:div.property-value.col-span-3 + [:div.property-value.col-span-3.inline-grid (property-value block property v opts)])])))) (new-property block edit-input-id properties new-property? opts)]))) diff --git a/src/main/frontend/components/property.css b/src/main/frontend/components/property.css index 601144f169..1d3331b188 100644 --- a/src/main/frontend/components/property.css +++ b/src/main/frontend/components/property.css @@ -80,8 +80,6 @@ .block-main-container .ls-properties-area { margin-top: 0.25em; - gap: 0; - .property-pair { gap: 0; } diff --git a/src/main/frontend/handler/editor.cljs b/src/main/frontend/handler/editor.cljs index e6d6df6527..ba946fb86e 100644 --- a/src/main/frontend/handler/editor.cljs +++ b/src/main/frontend/handler/editor.cljs @@ -3361,6 +3361,8 @@ (and (config/db-based-graph? repo) (seq (:block/properties block)) (not (pu/all-built-in-properties? (keys (:block/properties block))))) + (and (config/db-based-graph? repo) + (seq (:block/tags block))) (and (:outliner/block-title-collapse-enabled? (state/get-config)) (block-with-title? (:block/format block)