mirror of
https://github.com/logseq/logseq.git
synced 2026-05-03 10:26:35 +00:00
refactor indent-and-outdent
This commit is contained in:
@@ -326,17 +326,20 @@
|
||||
last)]
|
||||
(get-original-block-by-dom last-block-node)))))
|
||||
|
||||
(defn indent-outdent-block!
|
||||
[block direction]
|
||||
(ui-outliner-tx/transact!
|
||||
{:outliner-op :move-blocks
|
||||
:real-outliner-op :indent-outdent}
|
||||
(outliner-core/indent-outdent-blocks! (state/get-current-repo)
|
||||
(db/get-db false)
|
||||
(get-top-level-blocks [block])
|
||||
(= direction :right)
|
||||
{:get-first-block-original get-first-block-original
|
||||
:logical-outdenting? (state/logical-outdenting?)})))
|
||||
(defn indent-outdent-blocks!
|
||||
[blocks indent? save-current-block]
|
||||
(when (seq blocks)
|
||||
(let [blocks (get-top-level-blocks blocks)]
|
||||
(ui-outliner-tx/transact!
|
||||
{:outliner-op :move-blocks
|
||||
:real-outliner-op :indent-outdent}
|
||||
(when save-current-block (save-current-block))
|
||||
(outliner-core/indent-outdent-blocks! (state/get-current-repo)
|
||||
(db/get-db false)
|
||||
(get-top-level-blocks blocks)
|
||||
indent?
|
||||
{:parent-original (get-first-block-original)
|
||||
:logical-outdenting? (state/logical-outdenting?)})))))
|
||||
|
||||
(def *swipe (atom nil))
|
||||
|
||||
@@ -461,13 +464,13 @@
|
||||
(and left-menu (>= (.-clientWidth left-menu) 40))
|
||||
(when (indentable? block)
|
||||
(haptics/with-haptics-impact
|
||||
(indent-outdent-block! block :right)
|
||||
(indent-outdent-blocks! [block] true nil)
|
||||
:light))
|
||||
|
||||
(and right-menu (<= 40 (.-clientWidth right-menu) 79))
|
||||
(when (outdentable? block)
|
||||
(haptics/with-haptics-impact
|
||||
(indent-outdent-block! block :left)
|
||||
(indent-outdent-blocks! [block] false nil)
|
||||
:light))
|
||||
|
||||
(and right-menu (>= (.-clientWidth right-menu) 80))
|
||||
|
||||
Reference in New Issue
Block a user