perf: no need to clear-edit! when editing new block

experiment/tanstack-table
Tienson Qin 2024-06-19 03:40:08 +08:00
parent 02160042fb
commit d08102444d
3 changed files with 4 additions and 8 deletions

View File

@ -679,10 +679,6 @@
(undo-redo/record-editor-info! repo (ldb/read-transit-str editor-info-str))
nil)
(keep-alive
[_this]
"alive")
(dangerousRemoveAllDbs
[this repo]
(p/let [dbs (.listDB this)]
@ -717,6 +713,7 @@
(rename-page! repo conn page-uuid new-name))
:delete-page (fn [repo conn [page-uuid]]
(delete-page! repo conn page-uuid))}))
(defn init
"web worker entry"
[]

View File

@ -173,8 +173,6 @@
(defn- edit-block-aux
[repo block content text-range {:keys [container-id]}]
(when block
(when (not= (:db/id block) (:db/id (state/get-edit-block)))
(state/clear-edit!))
(let [container-id (or container-id
(state/get-current-editor-container-id)
:unknown-container)]

View File

@ -67,8 +67,9 @@
([input n] (move-cursor-to input n false))
([input n delay?]
(.setSelectionRange input n n)
(when-not (= js/document.activeElement input)
(let [focus #(.focus input)]
(if delay? (js/setTimeout focus 16) (focus)))))
(if delay? (js/setTimeout focus 16) (focus))))))
(defn move-cursor-forward
([input]