فهرست منبع

chore: cleanup unused code

Tienson Qin 1 سال پیش
والد
کامیت
e8ac2ecb05

+ 1 - 4
src/main/frontend/components/block.cljs

@@ -3003,10 +3003,7 @@
 
        (when (and db-based? (not collapsed?))
          [:div {:style {:padding-left 29}}
-          (db-properties-cp config
-                            block
-                            edit-input-id
-                            {:in-block-container? true})])
+          (db-properties-cp config block edit-input-id {})])
 
        (when-not (or (:hide-children? config) in-whiteboard?)
          (let [config' (-> (update config :level inc)

+ 6 - 7
src/main/frontend/components/property.cljs

@@ -146,7 +146,7 @@
 (rum/defc schema-type <
   shortcut/disable-all-shortcuts
   [property {:keys [*property-name *property-schema built-in? disabled?
-                    show-type-change-hints? in-block-container? block *show-new-property-config?
+                    show-type-change-hints? block *show-new-property-config?
                     default-open? page-configure? class-schema?]
              :as opts}]
   (let [property-name (or (and *property-name @*property-name) (:block/original-name property))
@@ -157,7 +157,7 @@
                           (map (fn [type]
                                  {:label (property-type-label type)
                                   :value type})))]
-    [:div {:class (if in-block-container? "flex flex-1" "flex items-center col-span-2")}
+    [:div {:class "flex items-center col-span-2"}
      (shui/select
       (cond->
        {:default-open (boolean default-open?)
@@ -435,7 +435,7 @@
                      (reset! *property-key nil))
                    state)}
   shortcut/disable-all-shortcuts
-  [state block *property-key {:keys [class-schema? in-block-container? page? page-configure?]
+  [state block *property-key {:keys [class-schema? page? page-configure?]
                               :as opts}]
   (let [*show-new-property-config? (::show-new-property-config? state)
         *property-schema (::property-schema state)
@@ -446,7 +446,7 @@
         exclude-properties (fn [m]
                              (or (and (not page?) (contains? existing-tag-alias (:block/original-name m)))
                                  ;; Filters out properties from being in wrong :view-context
-                                 (and in-block-container? (= :page (get-in m [:block/schema :view-context])))
+                                 (and (not page?) (= :page (get-in m [:block/schema :view-context])))
                                  (and page? (= :block (get-in m [:block/schema :view-context])))))
         property-key (rum/react *property-key)]
     [:div.ls-property-input.flex.flex-1.flex-row.items-center.flex-wrap.gap-1
@@ -462,7 +462,6 @@
                                           {:*property-name *property-key
                                            :*property-schema *property-schema
                                            :default-open? true
-                                           :in-block-container? in-block-container?
                                            :block block
                                            :*show-new-property-config? *show-new-property-config?}))
              (when (and property (not class-schema?))
@@ -726,7 +725,7 @@
    :will-remount (fn [state]
                    (let [block (db/entity (:db/id (::block state)))]
                      (assoc state ::classes (async-load-classes! block))))}
-  [state _target-block {:keys [in-block-container? page-configure? class-schema?] :as opts}]
+  [state _target-block {:keys [page-configure? class-schema?] :as opts}]
   (let [id (::id state)
         block (db/sub-block (:db/id (::block state)))
         _ (doseq [class (::classes state)]
@@ -815,7 +814,7 @@
                    (not (:page-configure? opts)))
       [:div.ls-properties-area
        (cond-> {:id id}
-         (and in-block-container? class-schema?)
+         class-schema?
          (assoc :class "class-properties")
          true (assoc :tab-index 0
                      :on-key-up #(when-let [block (and (= "Escape" (.-key %))

+ 1 - 1
src/main/frontend/components/property.css

@@ -282,7 +282,7 @@ a.control-link {
 }
 
 .ls-popup-closed:focus {
-    @apply font-bold outline-none;
+    @apply font-medium outline-none;
 }
 
 .positioned-properties .property-k:focus, .positioned-properties .ls-popup-closed:focus {

+ 1 - 1
src/main/frontend/components/property/value.cljs

@@ -497,7 +497,7 @@
         (let [properties-cp (:properties-cp opts)]
           (when (and entity properties-cp)
             [:div.property-block-container.content.property-template
-             (properties-cp config entity (:editor-id config) (merge opts {:in-block-container? true}))]))))))
+             (properties-cp config entity (:editor-id config) opts)]))))))
 
 (defn- create-template-block!
   [block property v-block *template-instance]

+ 1 - 1
src/main/frontend/handler/db_based/property.cljs

@@ -100,9 +100,9 @@
 
 (defn set-property-by-shortcut!
   [shortcut]
-  ;; TODO: support setting multiple blocks property
   (let [properties (ldb/get-all-properties (db/get-db))
         ;; TODO: what if multiple properties have the same shortcut?
+        ;; maybe picking a property first?
         property (some (fn [p] (when (= shortcut (get-in p [:block/schema :shortcut])) p)) properties)]
     (when property
       (state/pub-event! [:editor/new-property {:property-key (:block/original-name property)}]))))

+ 1 - 2
src/main/frontend/handler/events.cljs

@@ -968,12 +968,11 @@
          current-block (when-let [s (state/get-current-page)]
                          (when (util/uuid-string? s)
                            (db/entity [:block/uuid (uuid s)])))
-         in-block-container? (boolean edit-block-or-selected)
          blocks (or (when block [block])
                     edit-block-or-selected
                     (when current-block [current-block]))]
      (when (seq blocks)
-       (shui/dialog-open! #(property-dialog/dialog blocks (assoc opts :in-block-container? in-block-container?))
+       (shui/dialog-open! #(property-dialog/dialog blocks opts)
                           {:id :property-dialog
                            :align "start"
                            :content-props {:onOpenAutoFocus #(.preventDefault %)}