fix: bullet blink when creating a new block

pull/10793/head
Tienson Qin 2024-01-16 15:00:57 +08:00
parent 45348a694b
commit 83d128ecb0
3 changed files with 11 additions and 1 deletions

View File

@ -3028,7 +3028,9 @@
(block-mouse-leave e *control-show? block-id doc-mode?))}
(when (and (not slide?) (not in-whiteboard?) (not hidden?))
(block-control config block uuid block-id collapsed? *control-show?
(or edit? (= uuid (:block/uuid (state/get-edit-block))))))
(or edit?
(= uuid (:block/uuid (state/get-edit-block)))
(contains? @(:editor/new-created-blocks @state/state) uuid))))
(when (and @*show-left-menu? (not in-whiteboard?) (not hidden?))
(block-left-menu config block))

View File

@ -55,6 +55,13 @@
(when-not (or undo? redo?)
(update-current-tx-editor-cursor! tx-report)))
(let [new-datoms (filter (fn [datom]
(and
(= :block/uuid (:a datom))
(true? (:added datom)))) tx-data)]
(when (seq new-datoms)
(state/set-state! :editor/new-created-blocks (set (map :v new-datoms)))))
(let [pages (set (keep #(when (= :block/name (:a %)) (:v %)) tx-data))]
(when (seq pages)
(mark-pages-as-loaded! repo pages)))

View File

@ -150,6 +150,7 @@
:db/properties-changed-pages {}
:editor/cursor-range (atom nil)
:editor/new-created-blocks (atom #{})
:selection/mode (atom false)
;; Warning: blocks order is determined when setting this attribute