aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/ui/MessageInput.js
diff options
context:
space:
mode:
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} />