Files
logseq/src/main/frontend/db.cljs
Gabriel Horner 208b4bc205 fix: remove whiteboards and tldraw from rest of codebase
Also remove some old excalidraw refs that should've been removed awhile
back
2026-01-22 13:19:58 -05:00

53 lines
1.6 KiB
Clojure

(ns frontend.db
"Main entry ns for db related fns"
(:require [frontend.config :as config]
[frontend.db.conn :as conn]
[frontend.db.model]
[frontend.db.utils]
[frontend.modules.outliner.op :as outliner-op]
[frontend.modules.outliner.ui :as ui-outliner-tx]
[frontend.namespaces :refer [import-vars]]
[frontend.state :as state]
[logseq.db :as ldb]
[logseq.outliner.op]))
(import-vars
[frontend.db.conn
;; TODO: remove later
get-repo-name
get-short-repo-name
get-db
remove-conn!]
[frontend.db.utils
entity pull pull-many]
[frontend.db.model
get-block-and-children get-block-by-uuid sort-by-order
get-block-parent get-block-parents
get-block-immediate-children get-file
get-latest-journals get-page get-case-page
get-page-format journal-page? page? sub-block
page-exists? get-alias-source-page has-children?])
(defn start-db-conn!
([repo]
(start-db-conn! repo {}))
([repo option]
(conn/start! repo option)))
(def new-block-id ldb/new-block-id)
(defn transact!
([tx-data]
(transact! (state/get-current-repo) tx-data nil))
([repo tx-data]
(transact! repo tx-data nil))
([repo tx-data tx-meta]
(if config/publishing?
;; :save-block is for query-table actions like sorting and choosing columns
(when (or (#{:collapse-expand-blocks :save-block} (:outliner-op tx-meta))
(:init-db? tx-meta))
(conn/transact! repo tx-data tx-meta))
(ui-outliner-tx/transact! tx-meta
(outliner-op/transact! tx-data tx-meta)))))