diff --git a/deps/db/src/logseq/db/frontend/malli_schema.cljs b/deps/db/src/logseq/db/frontend/malli_schema.cljs index 80d647dcbe..1920de57a6 100644 --- a/deps/db/src/logseq/db/frontend/malli_schema.cljs +++ b/deps/db/src/logseq/db/frontend/malli_schema.cljs @@ -88,7 +88,7 @@ "Common attributes for pages" [[:block/name :string] [:block/original-name :string] - [:block/type {:optional true} [:enum #{"property"} #{"class"} #{"object"} #{"whiteboard"} #{"hidden"}]] + [:block/type {:optional true} [:enum #{"property"} #{"class"} #{"whiteboard"} #{"hidden"}]] [:block/journal? :boolean] [:block/alias {:optional true} [:set :int]] ;; TODO: Should this be here or in common? @@ -98,21 +98,14 @@ (vec (concat [:map + ;; Only for linked pages + [:block/collapsed? {:optional true} :boolean] ;; journal-day is only set for journal pages [:block/journal-day {:optional true} :int] [:block/namespace {:optional true} :int]] page-attrs page-or-block-attrs))) -(def object-page - (vec - (concat - [:map - [:block/collapsed? {:optional true} :boolean] - [:block/tags [:set :int]]] - page-attrs - (remove #(= :block/tags (first %)) page-or-block-attrs)))) - (def class-page (vec (concat @@ -183,7 +176,6 @@ [:multi {:dispatch :block/type} [#{"property"} property-page] [#{"class"} class-page] - [#{"object"} object-page] [#{"hidden"} hidden-page] [:malli.core/default normal-page]]) @@ -212,16 +204,6 @@ [:block/priority {:optional true} :string] [:block/collapsed? {:optional true} :boolean]]) -(def object-block - "A normal block with tags" - (vec - (concat - [:map] - [[:block/type [:= #{"object"}]] - [:block/tags [:set :int]]] - block-attrs - (remove #(= :block/tags (first %)) page-or-block-attrs)))) - (def whiteboard-block "A (shape) block for whiteboard" (vec @@ -260,7 +242,6 @@ "A block has content and a page" [:or normal-block - object-block closed-value-block whiteboard-block]) diff --git a/src/main/frontend/components/page.cljs b/src/main/frontend/components/page.cljs index fb8ae5a8ad..6ad35c62fc 100644 --- a/src/main/frontend/components/page.cljs +++ b/src/main/frontend/components/page.cljs @@ -1338,7 +1338,7 @@ [:div.r.flex.items-center.justify-between [:div (ui/select (->> (if (config/db-based-graph? current-repo) - ["" "class" "property" "object" "whiteboard"] + ["" "class" "property" "whiteboard"] ["" "whiteboard"]) (map (fn [block-type] {:label (if (seq block-type) (string/capitalize block-type) "Filter by page type") diff --git a/src/main/frontend/db/rtc/const.cljs b/src/main/frontend/db/rtc/const.cljs index a2a94f7887..ffe6461640 100644 --- a/src/main/frontend/db/rtc/const.cljs +++ b/src/main/frontend/db/rtc/const.cljs @@ -19,7 +19,7 @@ (def general-attr-set (into #{} (map first) general-attrs-schema-coll)) -(def block-type-schema [:enum "property" "class" "whiteboard" "object" "hidden" "closed value"]) +(def block-type-schema [:enum "property" "class" "whiteboard" "hidden" "closed value"]) (def to-ws-op-schema [:multi {:dispatch first :decode/string #(update % 0 keyword)} diff --git a/src/main/frontend/db/rtc/full_upload_download_graph.cljs b/src/main/frontend/db/rtc/full_upload_download_graph.cljs index 32233a11f2..ced8139df8 100644 --- a/src/main/frontend/db/rtc/full_upload_download_graph.cljs +++ b/src/main/frontend/db/rtc/full_upload_download_graph.cljs @@ -62,8 +62,7 @@ {:block-type/property "property" :block-type/class "class" :block-type/whiteboard "whiteboard" - :block-type/macros "macros" - :block-type/object "object"}) + :block-type/macros "macros"}) (defn- replace-db-id-with-temp-id diff --git a/src/main/frontend/handler/db_based/property.cljs b/src/main/frontend/handler/db_based/property.cljs index 0e912885be..9982dc8067 100644 --- a/src/main/frontend/handler/db_based/property.cljs +++ b/src/main/frontend/handler/db_based/property.cljs @@ -439,9 +439,7 @@ :block/tags)] (when property-value-id (db/transact! repo - (cond-> [[:db/retract (:db/id block) attribute property-value-id]] - (and :block/tags (= 1 (count (:block/tags block)))) - (conj [:db/retract (:db/id block) :block/type "object"])) + [[:db/retract (:db/id block) attribute property-value-id]] {:outliner-op :save-block}))) (if (= :many (:cardinality schema)) (let [properties (:block/properties block) diff --git a/src/main/frontend/modules/outliner/core.cljs b/src/main/frontend/modules/outliner/core.cljs index 46386402f3..396978aca0 100644 --- a/src/main/frontend/modules/outliner/core.cljs +++ b/src/main/frontend/modules/outliner/core.cljs @@ -150,7 +150,7 @@ (vector :db.fn/retractEntity (:db/id %))) (:block/macros block-entity))))))) -(defn- create-object-when-save +(defn- create-linked-page-when-save [txs-state block-entity m structured-tags?] (if structured-tags? (let [content (state/get-edit-content) @@ -158,7 +158,7 @@ sanity-linked-page (some-> linked-page util/page-name-sanity-lc) linking-page? (and (not (string/blank? sanity-linked-page)) @(:editor/create-page? @state/state))] - (if linking-page? + (when linking-page? (let [existing-ref-id (some (fn [r] (when (= sanity-linked-page (:block/name r)) (:block/uuid r))) @@ -178,17 +178,12 @@ (concat txs [(assoc page-m :block/tags (:block/tags m) - :block/format :markdown - :block/type "object") + :block/format :markdown) {:db/id (:db/id block-entity) :block/content "" :block/refs [] :block/link [:block/uuid (:block/uuid page-m)]}] - merge-tx)))) - (swap! txs-state (fn [txs] - (concat txs - [{:db/id (:db/id block-entity) - :block/type "object"}]))))) + merge-tx)))))) (reset! (:editor/create-page? @state/state) false))) (defn rebuild-block-refs @@ -337,7 +332,7 @@ (swap! txs-state conj (dissoc m :db/other-tx))) - (create-object-when-save txs-state block-entity m structured-tags?) + (create-linked-page-when-save txs-state block-entity m structured-tags?) (rebuild-refs repo txs-state block-entity m)