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]
(let [id (random-uuid)
*ref (atom nil)
<load-block (fn []
(let [block-id (:block/uuid (nth (:rum/args state) 3))]
(db-async/<get-block (state/get-current-repo) block-id :children? false)))]
(<load-block)
block (nth (:rum/args state) 3)
block-id (:block/uuid block)
repo (state/get-current-repo)]
(db-async/<get-block repo block-id :children? false)
(assoc state
::sub-id id
::ref *ref)))}

View File

@ -730,19 +730,21 @@
;; 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
{: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
::id (str (random-uuid))
::tags-requested? (atom false)))}
[state target-block edit-input-id {:keys [in-block-container? page-configure? class-schema?] :as opts}]
::block block
::classes all-classes)))}
[state _target-block edit-input-id {:keys [in-block-container? page-configure? class-schema?] :as opts}]
(let [id (::id state)
*tags-requested? (::tags-requested? state)
repo (state/get-current-repo)
block (resolve-linked-block-if-exists target-block)
_ (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))))
block (::block state)
_ (doseq [class (::classes state)]
(db/sub-block (:db/id class)))
page? (db/page? block)
block-properties (:block/properties block)
properties (if (and class-schema? page-configure?)

View File

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