fix: somehow repeated content when pressing Enter too fast

experiment/tanstack-table
Tienson Qin 2024-06-21 21:22:44 +08:00
parent 9f9e5d21ce
commit 4921480e0f
2 changed files with 23 additions and 23 deletions

View File

@ -63,7 +63,7 @@
download-logs upload-logs misc-logs pending-local-ops pending-server-ops]} (rum/react *detail-info)] download-logs upload-logs misc-logs pending-local-ops pending-server-ops]} (rum/react *detail-info)]
[:div.rtc-info.flex.flex-col.gap-1.p-2.text-gray-11 [:div.rtc-info.flex.flex-col.gap-1.p-2.text-gray-11
[:div.font-medium.mb-2 (if online? "Online" "Offline")] [:div.font-medium.mb-2 (if online? "Online" "Offline")]
[:div [:span.font-medium.mr-1 pending-local-ops] "pending local changes"] [:div [:span.font-medium.mr-1 (or pending-local-ops 0)] "pending local changes"]
;; FIXME: pending-server-ops ;; FIXME: pending-server-ops
[:div [:span.font-medium.mr-1 (or pending-server-ops 0)] "pending server changes"] [:div [:span.font-medium.mr-1 (or pending-server-ops 0)] "pending server changes"]
;; FIXME: What's the type for downloaded log? ;; FIXME: What's the type for downloaded log?

View File

@ -392,11 +392,10 @@
next-block (-> (merge (select-keys block [:block/parent :block/format :block/page]) next-block (-> (merge (select-keys block [:block/parent :block/format :block/page])
new-m) new-m)
(wrap-parse-block)) (wrap-parse-block))
sibling? (or (:block/collapsed? (:block/link block)) (when block-self? false))] sibling? (or (:block/collapsed? (:block/link block)) (when block-self? false))
(util/set-change-value input fst-block-text) result (outliner-insert-block! config current-block next-block {:sibling? sibling?
(let [result (outliner-insert-block! config current-block next-block {:sibling? sibling?
:keep-uuid? true})] :keep-uuid? true})]
[result sibling? (assoc next-block :block/content snd-block-text)]))) [result sibling? next-block]))
(defn clear-when-saved! (defn clear-when-saved!
[] []
@ -1855,7 +1854,8 @@
(defonce *auto-save-timeout (atom nil)) (defonce *auto-save-timeout (atom nil))
(defn edit-box-on-change! (defn edit-box-on-change!
[e _block id] [e block id]
(when (= (:db/id block) (:db/id (state/get-edit-block)))
(let [value (util/evalue e) (let [value (util/evalue e)
repo (state/get-current-repo)] repo (state/get-current-repo)]
(state/set-edit-content! id value false) (state/set-edit-content! id value false)
@ -1872,7 +1872,7 @@
(re-find #"#\S+" value)))) (re-find #"#\S+" value))))
; don't auto-save for page's properties block ; don't auto-save for page's properties block
(save-current-block! {:skip-properties? true}))) (save-current-block! {:skip-properties? true})))
450)))) 450)))))
(defn- start-of-new-word? (defn- start-of-new-word?
[input pos] [input pos]