mirror of
https://github.com/logseq/logseq.git
synced 2026-05-04 02:46:45 +00:00
enhance(perf): insert and delete blocks (#9142)
* enhance(perf): improve performance for both insert and delete * fix: remember cursor pos before executing the body in a transaction Otherwise, the edit-block and position could be changed * fix: disable delete-concat when there's no child or right sibling --------- Co-authored-by: Gabriel Horner <97210743+logseq-cldwalker@users.noreply.github.com> Co-authored-by: Gabriel Horner <gabriel@logseq.com>
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
[frontend.db :as db]
|
||||
[frontend.db.model :as db-model]
|
||||
[frontend.db.react :as react]
|
||||
[frontend.db.utils :as db-utils]
|
||||
[frontend.mobile.haptics :as haptics]
|
||||
[frontend.modules.outliner.core :as outliner-core]
|
||||
[frontend.modules.outliner.transaction :as outliner-tx]
|
||||
@@ -70,14 +69,9 @@
|
||||
(util/distinct-by :db/id))))))
|
||||
|
||||
(defn indentable?
|
||||
[{:block/keys [parent] :as block}]
|
||||
[{:block/keys [parent left]}]
|
||||
(when parent
|
||||
(let [parent-block (db-utils/pull (:db/id parent))
|
||||
first-child (first
|
||||
(db-model/get-block-immediate-children
|
||||
(state/get-current-repo)
|
||||
(:block/uuid parent-block)))]
|
||||
(not= (:db/id block) (:db/id first-child)))))
|
||||
(not= parent left)))
|
||||
|
||||
(defn outdentable?
|
||||
[{:block/keys [level] :as _block}]
|
||||
|
||||
Reference in New Issue
Block a user