mirror of https://github.com/logseq/logseq
Merge branch 'feat/outliner-core' into feat/integration-plugins-core
commit
4ad0bd2eae
|
@ -174,9 +174,10 @@
|
|||
[repo]
|
||||
(when-let [database (get-db repo)]
|
||||
(.close database)
|
||||
(let [[_ db-full-path] (get-db-full-path repo)]
|
||||
(let [[db-name db-full-path] (get-db-full-path repo)]
|
||||
(println "Delete search indice: " db-full-path)
|
||||
(fs/unlinkSync db-full-path))))
|
||||
(fs/unlinkSync db-full-path)
|
||||
(swap! databases dissoc db-name))))
|
||||
|
||||
(defn query
|
||||
[repo sql]
|
||||
|
|
|
@ -47,7 +47,8 @@
|
|||
[frontend.modules.outliner.core :as outliner-core]
|
||||
[frontend.db.outliner :as outliner-db]
|
||||
[frontend.modules.outliner.tree :as tree]
|
||||
[frontend.debug :as debug]))
|
||||
[frontend.debug :as debug]
|
||||
[datascript.core :as d]))
|
||||
|
||||
;; FIXME: should support multiple images concurrently uploading
|
||||
|
||||
|
@ -1016,7 +1017,9 @@
|
|||
(if block-id
|
||||
(let [repo (state/get-current-repo)
|
||||
block-parent (db/get-block-parent repo block-id)]
|
||||
(if-let [id (:block/uuid block-parent)]
|
||||
(if-let [id (and
|
||||
(nil? (:block/name block-parent))
|
||||
(:block/uuid block-parent))]
|
||||
(route-handler/redirect! {:to :page
|
||||
:path-params {:name (str id)}})
|
||||
(let [page-id (-> (db/entity [:block/uuid block-id])
|
||||
|
|
|
@ -482,6 +482,21 @@
|
|||
(tree/-set-left-id (tree/-get-id last-node))
|
||||
(tree/-save txs-state))))))))
|
||||
|
||||
|
||||
(defn- set-nodes-page&file-aux
|
||||
[node page file txs-state]
|
||||
(let [new-node (update node :data assoc :block/page page :block/file file)]
|
||||
(tree/-save new-node txs-state)
|
||||
(doseq [n (tree/-get-children new-node)]
|
||||
(set-nodes-page&file-aux n page file txs-state))))
|
||||
|
||||
(defn- set-nodes-page&file
|
||||
[node target-node txs-state]
|
||||
(let [page (or (get-in target-node [:data :block/page])
|
||||
{:db/id (get-in target-node [:data :db/id])}) ; or page block
|
||||
file (get-in target-node [:data :block/file])]
|
||||
(set-nodes-page&file-aux node page file txs-state)))
|
||||
|
||||
(defn move-subtree
|
||||
"Move subtree to a destination position in the relation tree.
|
||||
Args:
|
||||
|
@ -505,9 +520,10 @@
|
|||
(when (tree/satisfied-inode? right-node)
|
||||
(let [new-right-node (tree/-set-left-id right-node left-node-id)]
|
||||
(tree/-save new-right-node txs-state)))
|
||||
(if sibling?
|
||||
(let [new-root (first (if sibling?
|
||||
(insert-node-as-sibling txs-state root target-node)
|
||||
(insert-node-as-first-child txs-state root target-node)))))))
|
||||
(insert-node-as-first-child txs-state root target-node)))]
|
||||
(set-nodes-page&file new-root target-node txs-state)))))))
|
||||
|
||||
(defn get-right-node
|
||||
[node]
|
||||
|
|
Loading…
Reference in New Issue