mirror of
https://github.com/logseq/logseq.git
synced 2026-02-01 22:47:36 +00:00
fix: remove unused :block/type "object"
fixes LOG-2914
This commit is contained in:
25
deps/db/src/logseq/db/frontend/malli_schema.cljs
vendored
25
deps/db/src/logseq/db/frontend/malli_schema.cljs
vendored
@@ -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])
|
||||
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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)}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user