mirror of
https://github.com/logseq/logseq.git
synced 2026-05-28 06:34:34 +00:00
feat(rtc): sync attr :block/link
This commit is contained in:
@@ -13,13 +13,14 @@
|
||||
[:schema {:optional true} [:maybe :string]]
|
||||
[:tags {:optional true} [:maybe [:sequential :uuid]]]
|
||||
[:properties {:optional true} [:maybe :string ; transit-json-string
|
||||
]]])
|
||||
]]
|
||||
[:link {:optional true} :uuid]])
|
||||
|
||||
(def general-attr-set
|
||||
(into #{} (map first) general-attrs-schema-coll))
|
||||
|
||||
(def block-type-schema [:enum "property" "class" "whiteboard" "object" "hidden" "enum value"])
|
||||
(def op-schema
|
||||
(def to-ws-op-schema
|
||||
[:multi {:dispatch first :decode/string #(update % 0 keyword)}
|
||||
[:move
|
||||
[:cat :keyword
|
||||
@@ -55,7 +56,8 @@
|
||||
[:properties {:optional true} [:map
|
||||
[:add {:optional true} [:sequential [:cat :uuid :string ;; transit-string
|
||||
]]]
|
||||
[:retract {:optional true} [:set :uuid]]]]]]]
|
||||
[:retract {:optional true} [:set :uuid]]]]
|
||||
[:link {:optional true} :uuid]]]]
|
||||
[:update-page
|
||||
[:cat :keyword
|
||||
[:map
|
||||
@@ -72,7 +74,7 @@
|
||||
[:req-id :string]
|
||||
[:t {:optional true} :int]
|
||||
[:t-before {:optional true} :int]
|
||||
[:failed-ops {:optional true} [:sequential op-schema]]
|
||||
[:failed-ops {:optional true} [:sequential to-ws-op-schema]]
|
||||
[:s3-presign-url {:optional true} :string]
|
||||
[:affected-blocks {:optional true}
|
||||
[:map-of :uuid
|
||||
@@ -138,7 +140,7 @@
|
||||
[:req-id :string]
|
||||
[:action :string]
|
||||
[:graph-uuid :string]
|
||||
[:ops [:sequential op-schema]]
|
||||
[:ops [:sequential to-ws-op-schema]]
|
||||
[:t-before :int]]]
|
||||
["presign-put-temp-s3-obj"
|
||||
[:map
|
||||
|
||||
@@ -401,7 +401,10 @@
|
||||
(when-let [block-uuid
|
||||
(some (comp :block-uuid second) [move-op update-op update-page-op])]
|
||||
(when-let [block (db/pull repo
|
||||
'[{:block/left [:block/uuid]} {:block/parent [:block/uuid]} *]
|
||||
'[{:block/left [:block/uuid]}
|
||||
{:block/parent [:block/uuid]}
|
||||
{:block/link [:block/uuid]}
|
||||
*]
|
||||
[:block/uuid block-uuid])]
|
||||
(let [left-uuid (some-> block :block/left :block/uuid)
|
||||
parent-uuid (some-> block :block/parent :block/uuid)]
|
||||
@@ -443,12 +446,16 @@
|
||||
(:block/created-at block) (assoc :created-at (:block/created-at block))
|
||||
(contains? attr-map :schema) (assoc :schema
|
||||
(transit/write transit-w (:block/schema block)))
|
||||
attr-alias-map (assoc :alias attr-alias-map)
|
||||
attr-type-map (assoc :type attr-type-map)
|
||||
attr-tags-map (assoc :tags attr-tags-map)
|
||||
attr-properties-map (assoc :properties attr-properties-map)
|
||||
attr-alias-map (assoc :alias attr-alias-map)
|
||||
attr-type-map (assoc :type attr-type-map)
|
||||
attr-tags-map (assoc :tags attr-tags-map)
|
||||
attr-properties-map (assoc :properties attr-properties-map)
|
||||
(and (contains? attr-map :content)
|
||||
(:block/content block)) (assoc :content (:block/content block))
|
||||
(:block/content block))
|
||||
(assoc :content (:block/content block))
|
||||
(and (contains? attr-map :link)
|
||||
(:block/uuid (:block/link block)))
|
||||
(assoc :link (:block/uuid (:block/link block)))
|
||||
true (assoc :target-uuid left-uuid
|
||||
:sibling? (not= left-uuid parent-uuid)))])))))
|
||||
;; remote-update-page-op
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
(let [updated-general-attrs (seq (set/intersection
|
||||
updated-key-set
|
||||
#{:block/tags :block/alias :block/type :block/schema :block/content
|
||||
:block/properties}))
|
||||
:block/properties :block/link}))
|
||||
ops (cond-> []
|
||||
(or add3? add4?)
|
||||
(conj [:move])
|
||||
@@ -81,7 +81,7 @@
|
||||
(keep
|
||||
(fn [attr-name]
|
||||
(case attr-name
|
||||
(:block/schema :block/content)
|
||||
(:block/link :block/schema :block/content)
|
||||
{(keyword (name attr-name)) nil}
|
||||
|
||||
:block/alias
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
[:map {:closed true}
|
||||
[:schema {:optional true} :nil]
|
||||
[:content {:optional true} :nil]
|
||||
[:link {:optional true} :nil]
|
||||
[:alias {:optional true} [:map
|
||||
[:add {:optional true} [:set :uuid]]
|
||||
[:retract {:optional true} [:set :uuid]]]]
|
||||
|
||||
Reference in New Issue
Block a user