fix: text goes beneath toolbar in large block on iOS (#4179)

* fix(mobile): text goes beneath toolbar in large block

Co-authored-by: leizhe <leizhe@leizhedeMacBook-Air.local>
Co-authored-by: Andelf <andelf@gmail.com>
This commit is contained in:
llcc
2022-02-10 17:52:22 +08:00
committed by GitHub
parent 5778ae8004
commit b637c2d85a
2 changed files with 15 additions and 0 deletions

View File

@@ -3116,6 +3116,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]