mirror of https://github.com/logseq/logseq
enhance(mobile): make editing always in viewport when be close to bottom
parent
a04ab8e271
commit
672f181a92
|
@ -21,9 +21,9 @@
|
||||||
|
|
||||||
(when-let [element (gdom/getElement id)]
|
(when-let [element (gdom/getElement id)]
|
||||||
(.focus element)
|
(.focus element)
|
||||||
(when (and (util/mobile?)
|
(when (or (mobile-util/is-native-platform?)
|
||||||
(not (mobile-util/native-ios?)))
|
(util/mobile?))
|
||||||
(js/setTimeout #(util/make-el-into-viewport element 60) 64))))
|
(js/setTimeout #(util/make-el-into-viewport element 60) 80))))
|
||||||
state)
|
state)
|
||||||
|
|
||||||
(defn did-remount!
|
(defn did-remount!
|
||||||
|
|
|
@ -1491,10 +1491,11 @@
|
||||||
#?(:cljs
|
#?(:cljs
|
||||||
(defn make-el-into-viewport
|
(defn make-el-into-viewport
|
||||||
[^js/HTMLElement el offset]
|
[^js/HTMLElement el offset]
|
||||||
(let [wrap-height (.-clientHeight js/document.documentElement)
|
(let [viewport-height (or (.-height js/window.visualViewport)
|
||||||
|
(.-clientHeight js/document.documentElement))
|
||||||
target-bottom (.-bottom (.getBoundingClientRect el))]
|
target-bottom (.-bottom (.getBoundingClientRect el))]
|
||||||
(when (> (+ target-bottom (or (safe-parse-int offset) 0))
|
(when (> (+ target-bottom (or (safe-parse-int offset) 0))
|
||||||
wrap-height)
|
viewport-height)
|
||||||
(.scrollIntoView el #js {:block "center" :behavior "smooth"})))))
|
(.scrollIntoView el #js {:block "center" :behavior "smooth"})))))
|
||||||
|
|
||||||
#?(:cljs
|
#?(:cljs
|
||||||
|
|
Loading…
Reference in New Issue