mirror of
https://github.com/logseq/logseq.git
synced 2026-05-04 10:56:32 +00:00
fix: try to fix #811
This commit is contained in:
@@ -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)))
|
||||
|
||||
Reference in New Issue
Block a user