added focus input on reply click
This commit is contained in:
parent
0465442803
commit
0bce6c6a46
1 changed files with 7 additions and 2 deletions
|
@ -133,9 +133,14 @@ function ChannelViewInput({
|
||||||
deactivateCmd();
|
deactivateCmd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function focusInput() {
|
||||||
|
textAreaRef.current.focus();
|
||||||
|
}
|
||||||
|
|
||||||
function setUpReply(userId, eventId, content) {
|
function setUpReply(userId, eventId, content) {
|
||||||
setReplyTo({ userId, eventId, content });
|
setReplyTo({ userId, eventId, content });
|
||||||
roomsInput.setReplyTo(roomId, { userId, eventId, content });
|
roomsInput.setReplyTo(roomId, { userId, eventId, content });
|
||||||
|
focusInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -147,7 +152,7 @@ function ChannelViewInput({
|
||||||
viewEvent.on('reply_to', setUpReply);
|
viewEvent.on('reply_to', setUpReply);
|
||||||
if (textAreaRef?.current !== null) {
|
if (textAreaRef?.current !== null) {
|
||||||
isTyping = false;
|
isTyping = false;
|
||||||
textAreaRef.current.focus();
|
focusInput();
|
||||||
textAreaRef.current.value = roomsInput.getMessage(roomId);
|
textAreaRef.current.value = roomsInput.getMessage(roomId);
|
||||||
setAttachment(roomsInput.getAttachment(roomId));
|
setAttachment(roomsInput.getAttachment(roomId));
|
||||||
setReplyTo(roomsInput.getReplyTo(roomId));
|
setReplyTo(roomsInput.getReplyTo(roomId));
|
||||||
|
@ -192,7 +197,7 @@ function ChannelViewInput({
|
||||||
await roomsInput.sendInput(roomId);
|
await roomsInput.sendInput(roomId);
|
||||||
textAreaRef.current.disabled = false;
|
textAreaRef.current.disabled = false;
|
||||||
textAreaRef.current.style.cursor = 'unset';
|
textAreaRef.current.style.cursor = 'unset';
|
||||||
textAreaRef.current.focus();
|
focusInput();
|
||||||
|
|
||||||
textAreaRef.current.value = roomsInput.getMessage(roomId);
|
textAreaRef.current.value = roomsInput.getMessage(roomId);
|
||||||
timelineScroll.reachBottom();
|
timelineScroll.reachBottom();
|
||||||
|
|
Loading…
Reference in a new issue