Adjusted chat input to send text on on-submit-editing
Signed-off-by: Volodymyr Kozieiev <vkjr.sp@gmail.com>
This commit is contained in:
parent
f8ef431373
commit
0bc9fb6d9d
|
@ -327,15 +327,10 @@
|
||||||
:ref #(reset! inp-ref %)
|
:ref #(reset! inp-ref %)
|
||||||
:default-value input-text
|
:default-value input-text
|
||||||
:on-content-size-change #(set-container-height-fn (.-height (.-contentSize (.-nativeEvent %))))
|
:on-content-size-change #(set-container-height-fn (.-height (.-contentSize (.-nativeEvent %))))
|
||||||
:on-key-press (fn [e]
|
:submit-shortcut {:key "Enter"}
|
||||||
(let [native-event (.-nativeEvent e)
|
:on-submit-editing #(do (.clear @inp-ref)
|
||||||
key (.-key native-event)
|
(.focus @inp-ref)
|
||||||
modifiers (js->clj (.-modifiers native-event))
|
(re-frame/dispatch [:chat.ui/send-current-message]))
|
||||||
should-send (and (= key "Enter") (not (contains? (set modifiers) "shift")))]
|
|
||||||
(when should-send
|
|
||||||
(.clear @inp-ref)
|
|
||||||
(.focus @inp-ref)
|
|
||||||
(re-frame/dispatch [:chat.ui/send-current-message]))))
|
|
||||||
:on-change (fn [e]
|
:on-change (fn [e]
|
||||||
(let [native-event (.-nativeEvent e)
|
(let [native-event (.-nativeEvent e)
|
||||||
text (.-text native-event)]
|
text (.-text native-event)]
|
||||||
|
|
Loading…
Reference in New Issue