mirror of https://github.com/logseq/logseq
enhance(mobile): make input into viewport when initial editing
parent
6b45277229
commit
a72de57627
|
@ -162,7 +162,6 @@
|
||||||
(remove #(= (:url %) config/local-repo)))
|
(remove #(= (:url %) config/local-repo)))
|
||||||
electron-mac? (and util/mac? (util/electron?))
|
electron-mac? (and util/mac? (util/electron?))
|
||||||
vw-state (state/sub :ui/visual-viewport-state)
|
vw-state (state/sub :ui/visual-viewport-state)
|
||||||
vw-pending? (state/sub :ui/visual-viewport-pending?)
|
|
||||||
show-open-folder? (and (or (nfs/supported?)
|
show-open-folder? (and (or (nfs/supported?)
|
||||||
(mobile-util/is-native-platform?))
|
(mobile-util/is-native-platform?))
|
||||||
(empty? repos)
|
(empty? repos)
|
||||||
|
@ -172,8 +171,7 @@
|
||||||
[:div.cp__header#head
|
[:div.cp__header#head
|
||||||
{:class (util/classnames [{:electron-mac electron-mac?
|
{:class (util/classnames [{:electron-mac electron-mac?
|
||||||
:native-ios (mobile-util/native-ios?)
|
:native-ios (mobile-util/native-ios?)
|
||||||
:native-android (mobile-util/native-android?)
|
:native-android (mobile-util/native-android?)}])
|
||||||
:is-vw-pending (boolean vw-pending?)}])
|
|
||||||
:on-double-click (fn [^js e]
|
:on-double-click (fn [^js e]
|
||||||
(when-let [target (.-target e)]
|
(when-let [target (.-target e)]
|
||||||
(when (and (util/electron?)
|
(when (and (util/electron?)
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
(.focus element)
|
(.focus element)
|
||||||
(when (or (mobile-util/is-native-platform?)
|
(when (or (mobile-util/is-native-platform?)
|
||||||
(util/mobile?))
|
(util/mobile?))
|
||||||
(js/setTimeout #(util/make-el-into-viewport element 60) 80))))
|
(js/setTimeout #(util/make-el-into-viewport element 60) 64))))
|
||||||
state)
|
state)
|
||||||
|
|
||||||
(defn did-remount!
|
(defn did-remount!
|
||||||
|
|
|
@ -221,6 +221,15 @@
|
||||||
(reset! st/*inited? true)
|
(reset! st/*inited? true)
|
||||||
(st/consume-pending-shortcuts!)))
|
(st/consume-pending-shortcuts!)))
|
||||||
|
|
||||||
|
|
||||||
|
(defmethod handle :mobile/keyboard-will-show [[_]]
|
||||||
|
(when (state/get-left-sidebar-open?)
|
||||||
|
(state/set-left-sidebar-open! false)))
|
||||||
|
|
||||||
|
(defmethod handle :mobile/keyboard-did-show [[_]]
|
||||||
|
(when-let [input (state/get-input)]
|
||||||
|
(js/setTimeout #(util/make-el-into-viewport input 60) 64)))
|
||||||
|
|
||||||
(defn run!
|
(defn run!
|
||||||
[]
|
[]
|
||||||
(let [chan (state/get-events-chan)]
|
(let [chan (state/get-events-chan)]
|
||||||
|
|
|
@ -34,7 +34,9 @@
|
||||||
(when (mobile-util/native-ios?)
|
(when (mobile-util/native-ios?)
|
||||||
(let [path (fs/iOS-ensure-documents!)]
|
(let [path (fs/iOS-ensure-documents!)]
|
||||||
(println "iOS container path: " path))
|
(println "iOS container path: " path))
|
||||||
;; keyboard watcher
|
|
||||||
|
;; Keyboard watcher
|
||||||
(.addListener Keyboard "keyboardWillShow"
|
(.addListener Keyboard "keyboardWillShow"
|
||||||
#(when (state/get-left-sidebar-open?)
|
#(state/pub-event! [:mobile/keyboard-will-show]))
|
||||||
(state/set-left-sidebar-open! false)))))
|
(.addListener Keyboard "keyboardDidShow"
|
||||||
|
#(state/pub-event! [:mobile/keyboard-did-show]))))
|
||||||
|
|
Loading…
Reference in New Issue