fix: try to fix #811

This commit is contained in:
charlie
2020-12-05 12:01:51 +08:00
committed by Tienson Qin
parent 83e888d765
commit de33233ec2

View File

@@ -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)))