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);
|
const editInputRef = useRef(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
editInputRef.current.focus();
|
// makes the cursor end up at the end of the line instead of the beginning
|
||||||
|
editInputRef.current.value = '';
|
||||||
// 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
|
|
||||||
editInputRef.current.value = body;
|
editInputRef.current.value = body;
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
@ -267,9 +265,11 @@ function MessageEdit({ body, onSave, onCancel }) {
|
||||||
<Input
|
<Input
|
||||||
forwardRef={editInputRef}
|
forwardRef={editInputRef}
|
||||||
onKeyDown={handleKeyDown}
|
onKeyDown={handleKeyDown}
|
||||||
|
value={body}
|
||||||
placeholder="Edit message"
|
placeholder="Edit message"
|
||||||
required
|
required
|
||||||
resizable
|
resizable
|
||||||
|
autoFocus
|
||||||
/>
|
/>
|
||||||
<div className="message__edit-btns">
|
<div className="message__edit-btns">
|
||||||
<Button type="submit" variant="primary">Save</Button>
|
<Button type="submit" variant="primary">Save</Button>
|
||||||
|
|
Loading…
Reference in a new issue