Merge branch 'master' into fix/long-page-loading-and-collapsed-state

This commit is contained in:
Andelf
2022-02-11 14:19:03 +08:00
committed by GitHub
46 changed files with 577 additions and 259 deletions

View File

@@ -2977,7 +2977,9 @@
hashtag?
(do
(commands/handle-step [:editor/search-page-hashtag])
(state/set-last-pos! (cursor/pos input))
(if (= key "#")
(state/set-last-pos! (inc (cursor/pos input))) ;; In keydown handler, the `#` is not inserted yet.
(state/set-last-pos! (cursor/pos input)))
(reset! commands/*slash-caret-pos (cursor/get-caret-pos input)))
(let [sym "$"]
@@ -3003,7 +3005,7 @@
:else
nil))))
(defn keyup-handler
(defn ^:large-vars/cleanup-todo keyup-handler
[_state input input-id search-timeout]
(fn [e key-code]
(when-not (util/event-is-composing? e)
@@ -3116,6 +3118,20 @@
(let [input (gdom/getElement id)]
(close-autocomplete-if-outside input))))
(defn editor-on-height-change!
[id]
(fn [row-height]
(let [input (gdom/getElement id)
top (gobj/get (.getBoundingClientRect input) "top")
cursor-y (+ top row-height)
vw-height (.-height js/window.visualViewport)]
;; 40 is mobile toolbar height
(when (< vw-height (+ cursor-y 40))
(let [main-node (gdom/getElement "main-content-container")
scroll-top (.-scrollTop main-node)]
;; 24 is default line height
(set! (.-scrollTop main-node) (+ scroll-top 24)))))))
(defn editor-on-change!
[block id search-timeout]
(fn [e]