enhance: pub-event! returns a promise (#9671)

enhance: pub-event! returns a promise

fix: typing 1.  sometimes can result in 1. 1.
This commit is contained in:
Tienson Qin
2023-06-15 23:45:13 +08:00
committed by GitHub
parent eafca05387
commit 2d0f67429a
3 changed files with 22 additions and 16 deletions

View File

@@ -1873,10 +1873,9 @@
(cond
(and (= content "1. ") (= last-input-char " ") input-id edit-block
(not (own-order-number-list? edit-block)))
(do
(state/set-edit-content! input-id "")
(-> (p/delay 10)
(p/then #(state/pub-event! [:editor/toggle-own-number-list edit-block]))))
(p/do!
(state/pub-event! [:editor/toggle-own-number-list edit-block])
(state/set-edit-content! input-id ""))
(and (= last-input-char commands/command-trigger)
(or (re-find #"(?m)^/" (str (.-value input))) (start-of-new-word? input pos)))