File tree 2 files changed +8
-21
lines changed
src/status_im2/contexts/chat/composer
2 files changed +8
-21
lines changed Original file line number Diff line number Diff line change 106
106
(defn use-edit
107
107
[{:keys [input-ref]}
108
108
{:keys [text-value saved-cursor-position]}
109
- {:keys [edit]}]
109
+ {:keys [edit input-with-mentions ]}]
110
110
(rn/use-effect
111
111
(fn []
112
- (let [edit-text (get-in edit [:content :text ])
112
+ (let [mention? (some #(= :mention (first %)) (seq input-with-mentions))
113
+ mention-text (reduce (fn [acc item]
114
+ (str acc (second item)))
115
+ " "
116
+ input-with-mentions)
117
+ edit-text (if mention? mention-text (get-in edit [:content :text ]))
113
118
text-value-count (count @text-value)
114
119
inject-edit-text (fn []
115
120
(reset! text-value edit-text)
128
133
; ; text.
129
134
(js/setTimeout #(do (.focus ^js @input-ref)
130
135
(js/setTimeout inject-edit-text 250 ))
131
- 250 ))))
136
+ 100 ))))
132
137
[(:message-id edit)]))
133
138
134
139
(defn use-reply
143
148
(js/setTimeout #(.focus ^js @input-ref) 250 )))
144
149
[(:message-id reply)]))
145
150
146
- (defn edit-mentions
147
- [{:keys [input-ref]} {:keys [text-value cursor-position]} {:keys [input-with-mentions]}]
148
- (rn/use-effect (fn []
149
- (let [input-text (reduce (fn [acc item]
150
- (str acc (second item)))
151
- " "
152
- input-with-mentions)]
153
- (reset! text-value input-text)
154
- (reset! cursor-position (count input-text))
155
- (js/setTimeout #(when @input-ref
156
- (.setNativeProps ^js @input-ref
157
- (clj->js {:selection {:start (count input-text)
158
- :end (count
159
- input-text)}})))
160
- 300 )))
161
- [(some #(= :mention (first %)) (seq input-with-mentions))]))
162
-
163
151
(defn update-input-mention
164
152
[{:keys [input-ref]}
165
153
{:keys [text-value]}
Original file line number Diff line number Diff line change 76
76
(effects/use-edit props state subscriptions)
77
77
(effects/use-reply props animations subscriptions)
78
78
(effects/update-input-mention props state subscriptions)
79
- (effects/edit-mentions props state subscriptions)
80
79
(effects/link-previews props state animations subscriptions)
81
80
(effects/use-images props state animations subscriptions)
82
81
[:<>
You can’t perform that action at this time.
0 commit comments