Browse Source

chore: no need to keep keyboard open on mobile

Tienson Qin 1 day ago
parent
commit
0d134cb4c5

+ 0 - 2
src/main/frontend/components/block.cljs

@@ -2680,8 +2680,6 @@
                                           first
                                           util/caret-range)
                 mobile-range (when mobile? (get-cursor-range))]
-            (when-not forbidden-edit?
-              (util/mobile-keep-keyboard-open false))
             (when (and (not forbidden-edit?) (contains? #{1 0} button))
               (cond
                 (and meta? shift?)

+ 0 - 2
src/main/frontend/components/editor.cljs

@@ -768,8 +768,6 @@
       ;; exit editing mode
       :else
       (let [select? (= type :esc)]
-        (when (.closest (.-target e) ".block-content")
-          (util/mobile-keep-keyboard-open))
         (when-let [container (gdom/getElement "app-container")]
           (dom/remove-class! container "blocks-selection-mode"))
         (p/do!

+ 0 - 17
src/main/frontend/util.cljc

@@ -1484,23 +1484,6 @@ Arg *stop: atom, reset to true to stop the loop"
      (when target
        (some-> target (.querySelector ".CodeMirror") (.-CodeMirror)))))
 
-#?(:cljs
-   (defn get-keep-keyboard-input-el
-     ([] (get-keep-keyboard-input-el ""))
-     ([t]
-      (js/document.getElementById (str "keep-keyboard-open-input" t)))))
-
-#?(:cljs
-   (defn mobile-keep-keyboard-open
-     ([]
-      (mobile-keep-keyboard-open true))
-     ([schedule?]
-      (when (mobile?)
-        (let [f #(when-let [node (or (get-keep-keyboard-input-el "in-modal")
-                                     (get-keep-keyboard-input-el))]
-                   (.focus node))]
-          (if schedule? (schedule f) (f)))))))
-
 #?(:cljs
    (defn rtc-test?
      []

+ 0 - 1
src/main/mobile/components/app.cljs

@@ -156,7 +156,6 @@
      (when show-action-bar?
        (selection-toolbar/action-bar))
      (shui-popup/install-popups)
-     (ui-component/keep-keyboard-virtual-input)
      (ui-component/install-notifications)
      (shui-toaster/install-toaster)
      (shui-dialog/install-modals)]))

+ 1 - 3
src/main/mobile/components/editor_toolbar.cljs

@@ -205,11 +205,9 @@
   (let [editing? (state/sub :editor/editing?)
         code-block? (state/sub :editor/code-block-context)
         quick-add? (mobile-state/quick-add-open?)
-        keep-open? (= "app-keep-keyboard-open-input"
-                      (some-> js/document.activeElement (.-id)))
         show? (and (util/mobile?)
                    (not code-block?)
-                   (or editing? keep-open?))
+                   editing?)
         actions (toolbar-actions quick-add?)]
     (when (mobile-util/native-ios?)
       (native-toolbar show? actions))))

+ 0 - 8
src/main/mobile/components/ui.cljs

@@ -18,14 +18,6 @@
     [:div#main-container.flex.flex-1
      [:div.w-full content]]]])
 
-(rum/defc keep-keyboard-virtual-input
-  ([] (keep-keyboard-virtual-input ""))
-  ([t]
-   [:input.absolute.top-4.left-0.w-1.h-1.opacity-0
-    {:id (str "keep-keyboard-open-input" t)
-     :auto-capitalize "sentences"
-     :auto-correct "true"}]))
-
 (rum/defc notification-clear-all
   []
   [:div.ui__notifications-content