refactor: make-el-into-viewport

pull/3560/head
Tienson Qin 2021-12-23 13:05:05 +08:00
parent 717fdb5940
commit fc8d2727d1
4 changed files with 7 additions and 5 deletions

View File

@ -23,7 +23,7 @@
(.focus element)
(when (or (mobile-util/is-native-platform?)
(util/mobile?))
(util/make-el-into-viewport element 60))))
(util/make-el-into-viewport element))))
state)
(defn did-remount!

View File

@ -229,7 +229,7 @@
(defmethod handle :mobile/keyboard-did-show [[_]]
(when-let [input (state/get-input)]
(util/make-el-into-viewport input 60)))
(util/make-el-into-viewport input)))
(defn run!
[]

View File

@ -289,4 +289,4 @@
(when-let [input (state/get-input)]
(if (or (mobile/is-native-platform?)
(util/mobile?))
(util/make-el-into-viewport input 60))))
(util/make-el-into-viewport input))))

View File

@ -1490,6 +1490,8 @@
#?(:cljs
(defn make-el-into-viewport
([^js/HTMLElement el]
(make-el-into-viewport el 60))
([^js/HTMLElement el offset]
(make-el-into-viewport el offset true))
([^js/HTMLElement el offset async?]
@ -1511,14 +1513,14 @@
#?(:cljs
(defn event-is-composing?
"Check if keydown event is a composing (IME) event.
"Check if keydown event is a composing (IME) event.
Ignore the IME process by default."
([e]
(event-is-composing? e false))
([e include-process?]
(let [event-composing? (gobj/getValueByKeys e "event_" "isComposing")]
(if include-process?
(or event-composing?
(or event-composing?
(= (gobj/get e "keyCode") 229)
(= (gobj/get e "key") "Process"))
event-composing?)))))