mirror of
https://github.com/logseq/logseq.git
synced 2026-06-01 19:01:22 +00:00
Merge branch 'feat/db' into enhance/plugin-web
This commit is contained in:
@@ -2630,7 +2630,7 @@
|
||||
(db-property-handler/delete-property-value! (:db/id block) :block/tags (:db/id tag)))}
|
||||
(ui/icon "x" {:size 14
|
||||
:style {:margin-top 1}})]
|
||||
[:a.hash-symbol {:style {:margin-left 5}}
|
||||
[:a.hash-symbol.select-none {:style {:margin-left 5}}
|
||||
"#"])
|
||||
(page-cp (assoc config
|
||||
:disable-preview? true
|
||||
@@ -4130,7 +4130,7 @@
|
||||
(when (seq blocks)
|
||||
[:div.blocks-container.flex-1
|
||||
{:class (when doc-mode? "document-mode")
|
||||
:container-id (:container-id state)}
|
||||
:containerid (:container-id state)}
|
||||
(block-list (assoc config :container-id (:container-id state))
|
||||
blocks)])))
|
||||
|
||||
|
||||
@@ -372,7 +372,7 @@
|
||||
:title (block-handler/block-unique-title page)
|
||||
:draggable true
|
||||
:on-drag-start (fn [event] (editor-handler/block->data-transfer! (:block/name page) event true))
|
||||
:data-ref name}
|
||||
:data-ref (str name)}
|
||||
(page-name page (icon/get-node-icon-cp page {:size 16}) true)])])))
|
||||
|
||||
(defn get-default-home-if-valid
|
||||
@@ -380,7 +380,7 @@
|
||||
(when-let [default-home (state/get-default-home)]
|
||||
(let [page (:page default-home)
|
||||
page (when (and (string? page)
|
||||
(not (string/blank? page)))
|
||||
(not (string/blank? page)))
|
||||
(db/get-page page))]
|
||||
(if page
|
||||
default-home
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
:else
|
||||
(rum/with-key (sortable-item prop (:content item)) id))))
|
||||
children' (if parent-node
|
||||
[parent-node children]
|
||||
[parent-node {:key "parent-node"} children]
|
||||
children)]
|
||||
(dnd-context
|
||||
dnd-opts
|
||||
|
||||
@@ -597,24 +597,34 @@
|
||||
(= (:db/ident data) :logseq.kv/schema-version)
|
||||
nil
|
||||
|
||||
(:db/ident data)
|
||||
data
|
||||
|
||||
(:block/name data)
|
||||
(if-let [page (ldb/get-page @conn (:block/name data))]
|
||||
(:block/uuid data)
|
||||
(if-let [block (d/entity @conn [:block/uuid (:block/uuid data)])]
|
||||
(do
|
||||
(swap! *uuids assoc (:block/uuid data) (:block/uuid page))
|
||||
(assoc data :block/uuid (:block/uuid page)))
|
||||
(swap! *uuids assoc (:block/uuid data) (:block/uuid block))
|
||||
(let [existing-data (assoc (into {} block) :db/id (:db/id block))]
|
||||
(reduce
|
||||
(fn [data [k existing-value]]
|
||||
(update data k
|
||||
(fn [v]
|
||||
(if (and (coll? v) (not (map? v)))
|
||||
(concat v (if (coll? existing-value) existing-value [existing-value]))
|
||||
(if (some? existing-value) existing-value v)))))
|
||||
data
|
||||
existing-data)))
|
||||
data)
|
||||
|
||||
:else
|
||||
data)
|
||||
data))))
|
||||
;; using existing page's uuid
|
||||
data' (walk/postwalk
|
||||
data' (walk/prewalk
|
||||
(fn [f]
|
||||
(if (and (vector? f) (= :block/uuid (first f)) (@*uuids (second f)))
|
||||
(cond
|
||||
(and (de/entity? f) (:block/uuid f))
|
||||
(or (:db/ident f) [:block/uuid (:block/uuid f)])
|
||||
(and (vector? f) (= :block/uuid (first f)) (@*uuids (second f)))
|
||||
[:block/uuid (@*uuids (second f))]
|
||||
:else
|
||||
f))
|
||||
data)]
|
||||
(d/transact! conn data' {:fix-db? true
|
||||
|
||||
Reference in New Issue
Block a user