Explorar o código

fix: try to fix #811

charlie %!s(int64=4) %!d(string=hai) anos
pai
achega
de33233ec2
Modificáronse 1 ficheiros con 12 adicións e 5 borrados
  1. 12 5
      src/main/frontend/ui.cljs

+ 12 - 5
src/main/frontend/ui.cljs

@@ -18,13 +18,20 @@
 (defonce css-transition (r/adapt-class CSSTransition))
 (defonce textarea (r/adapt-class (gobj/get TextareaAutosize "default")))
 
-(rum/defc ls-textarea [{:keys [on-change] :as -props}]
-  (let [composition? (atom false)
+(rum/defc ls-textarea < rum/reactive
+  [{:keys [on-change] :as -props}]
+  (let [skip-composition? (or
+                           (state/sub :editor/show-page-search?)
+                           (state/sub :editor/show-block-search?)
+                           (state/sub :editor/show-template-search?))
+        composition? (atom false)
         set-composition? #(reset! composition? %)
         on-composition (fn [e]
-                         (case e.type
-                           "compositionend" (do (set-composition? false) (on-change e))
-                           (set-composition? true)))
+                         (if skip-composition?
+                           (on-change e)
+                           (case e.type
+                             "compositionend" (do (set-composition? false) (on-change e))
+                             (set-composition? true))))
         props (assoc -props
                      :on-change (fn [e] (when-not @composition?
                                           (on-change e)))