fix: properties are not displayed for tagged blocks

pull/11177/head
Tienson Qin 2024-04-24 14:15:03 +08:00
parent 4cb2ac6a46
commit 8aca502b9a
3 changed files with 19 additions and 17 deletions

View File

@ -2941,10 +2941,10 @@
{:init (fn [state] {:init (fn [state]
(let [id (random-uuid) (let [id (random-uuid)
*ref (atom nil) *ref (atom nil)
<load-block (fn [] block (nth (:rum/args state) 3)
(let [block-id (:block/uuid (nth (:rum/args state) 3))] block-id (:block/uuid block)
(db-async/<get-block (state/get-current-repo) block-id :children? false)))] repo (state/get-current-repo)]
(<load-block) (db-async/<get-block repo block-id :children? false)
(assoc state (assoc state
::sub-id id ::sub-id id
::ref *ref)))} ::ref *ref)))}

View File

@ -730,19 +730,21 @@
;; TODO: Remove :page-configure? as it only ever seems to be set to true ;; TODO: Remove :page-configure? as it only ever seems to be set to true
(rum/defcs ^:large-vars/cleanup-todo properties-area < rum/reactive db-mixins/query (rum/defcs ^:large-vars/cleanup-todo properties-area < rum/reactive db-mixins/query
{:init (fn [state] {:init (fn [state]
(let [repo (state/get-current-repo)
target-block (first (:rum/args state))
block (resolve-linked-block-if-exists target-block)
all-classes (concat (:block/tags block) (db-property-handler/get-class-parents (:block/tags block)))]
(doseq [class all-classes]
(db-async/<get-block repo (:db/id class) :children? false))
(assoc state (assoc state
::id (str (random-uuid)) ::id (str (random-uuid))
::tags-requested? (atom false)))} ::block block
[state target-block edit-input-id {:keys [in-block-container? page-configure? class-schema?] :as opts}] ::classes all-classes)))}
[state _target-block edit-input-id {:keys [in-block-container? page-configure? class-schema?] :as opts}]
(let [id (::id state) (let [id (::id state)
*tags-requested? (::tags-requested? state) block (::block state)
repo (state/get-current-repo) _ (doseq [class (::classes state)]
block (resolve-linked-block-if-exists target-block) (db/sub-block (:db/id class)))
_ (when (and (not @*tags-requested?) (:block/tags block))
(doseq [tag (:block/tags block)]
(db-async/<get-block repo (:block/uuid tag) {:children? false})
(reset! *tags-requested? true)
(db/sub-block (:db/id tag))))
page? (db/page? block) page? (db/page? block)
block-properties (:block/properties block) block-properties (:block/properties block)
properties (if (and class-schema? page-configure?) properties (if (and class-schema? page-configure?)

View File

@ -430,7 +430,7 @@
[[f (:db/id block) :block/collapsed-properties (:db/id property)]] [[f (:db/id block) :block/collapsed-properties (:db/id property)]]
{:outliner-op :save-block}))) {:outliner-op :save-block})))
(defn- get-class-parents (defn get-class-parents
[tags] [tags]
(let [tags' (filter (fn [tag] (contains? (:block/type tag) "class")) tags) (let [tags' (filter (fn [tag] (contains? (:block/type tag) "class")) tags)
*classes (atom #{})] *classes (atom #{})]