aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/ui/MessageInput.js
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-06-11 14:56:08 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:55 +0300
commitee5f3a4a78cd9a4cc2ed259ce599db95765f24ce (patch)
tree7e0243d335af5b93c49d5d29ce80988bbed8b220 /vnext/src/ui/MessageInput.js
parentbe48cd1cccacc0cf5b0f6c84455ab54a6a7bf672 (diff)
Message editing
Diffstat (limited to 'vnext/src/ui/MessageInput.js')
-rw-r--r--vnext/src/ui/MessageInput.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/vnext/src/ui/MessageInput.js b/vnext/src/ui/MessageInput.js
index e4988d59..fc3596cc 100644
--- a/vnext/src/ui/MessageInput.js
+++ b/vnext/src/ui/MessageInput.js
@@ -21,9 +21,8 @@ export default function MessageInput({ text, data, rows, children, onSend }) {
}
};
useEffect(() => {
- textareaRef.current.value = text || '';
updateFocus();
- }, [text]);
+ }, []);
let handleCtrlEnter = (event) => {
if (event.ctrlKey && (event.charCode == 10 || event.charCode == 13)) {
@@ -37,7 +36,9 @@ export default function MessageInput({ text, data, rows, children, onSend }) {
el.style.height = `${height + offset}px`;
};
const [attach, setAttach] = useState('');
- const [formState, { textarea }] = useFormState();
+ const [formState, { textarea }] = useFormState({
+ body: text
+ });
let uploadValueChanged = (attach) => {
setAttach(attach);
};
@@ -62,7 +63,7 @@ export default function MessageInput({ text, data, rows, children, onSend }) {
<form className="msg-comment-target" style={{ padding: '12px' }} onSubmit={onSubmit}>
<div style={commentStyle}>
<textarea onChange={textChanged} onKeyPress={handleCtrlEnter}
- ref={textareaRef} style={textInputStyle} value={formState.values.body}
+ ref={textareaRef} style={textInputStyle}
rows={rows || '1'} placeholder={children} {...textarea('body')} />
<div style={inputBarStyle}>
<UploadButton inputRef={fileinput} value={attach} onChange={uploadValueChanged} />