Fix edit message input not expending properly
Signed-off-by: ajbura <ajbura@gmail.com>
This commit is contained in:
parent
cdd909f2dd
commit
a17d5d01a7
1 changed files with 4 additions and 4 deletions
|
@ -248,10 +248,8 @@ function MessageEdit({ body, onSave, onCancel }) {
|
|||
const editInputRef = useRef(null);
|
||||
|
||||
useEffect(() => {
|
||||
editInputRef.current.focus();
|
||||
|
||||
// Setting the value here instead of using the value prop below
|
||||
// makes the cursor end up at the end of the line instead of the begining
|
||||
// makes the cursor end up at the end of the line instead of the beginning
|
||||
editInputRef.current.value = '';
|
||||
editInputRef.current.value = body;
|
||||
}, []);
|
||||
|
||||
|
@ -267,9 +265,11 @@ function MessageEdit({ body, onSave, onCancel }) {
|
|||
<Input
|
||||
forwardRef={editInputRef}
|
||||
onKeyDown={handleKeyDown}
|
||||
value={body}
|
||||
placeholder="Edit message"
|
||||
required
|
||||
resizable
|
||||
autoFocus
|
||||
/>
|
||||
<div className="message__edit-btns">
|
||||
<Button type="submit" variant="primary">Save</Button>
|
||||
|
|
Loading…
Reference in a new issue