mirror of
https://github.com/logseq/logseq.git
synced 2026-06-01 19:01:22 +00:00
29 lines
1.1 KiB
Clojure
29 lines
1.1 KiB
Clojure
(ns frontend.modules.outliner.ui
|
|
#?(:cljs (:require-macros [logseq.outliner.transaction]))
|
|
#?(:cljs (:require-macros [frontend.modules.outliner.ui]))
|
|
#?(:cljs (:require [frontend.state :as state]
|
|
[frontend.config :as config]
|
|
[frontend.db :as db])))
|
|
|
|
#?(:cljs
|
|
(do
|
|
(defn unlinked-graph?
|
|
[]
|
|
(let [repo (state/get-current-repo)]
|
|
(contains? (:file/unlinked-dirs @state/state)
|
|
(config/get-repo-dir repo))))
|
|
|
|
(def set-state-fn state/set-state!)))
|
|
|
|
(defmacro transact!
|
|
[opts & body]
|
|
`(do
|
|
(state/set-state! :ui/before-editor-cursor (state/get-current-edit-block-and-position))
|
|
|
|
(let [transact-opts# {:repo (state/get-current-repo)
|
|
:conn (db/get-db false)
|
|
:unlinked-graph? frontend.modules.outliner.ui/unlinked-graph?
|
|
:set-state-fn frontend.modules.outliner.ui/set-state-fn}]
|
|
(logseq.outliner.transaction/transact! (assoc ~opts :transact-opts transact-opts#)
|
|
~@body))))
|