Skip to content
Snippets Groups Projects
Commit 46943b64 authored by Yamagishi Kazutoshi's avatar Yamagishi Kazutoshi Committed by Eugen Rochko
Browse files

Reset textarea height when press submit key (#2681)

* Reset textarea height when press submit key

* dry

* DON'T NEED props
parent 302c0d20
No related branches found
No related tags found
No related merge requests found
......@@ -58,7 +58,6 @@ class AutosuggestTextarea extends React.Component {
}
// auto-resize textarea
e.target.style.height = 'auto';
e.target.style.height = `${e.target.scrollHeight}px`;
this.props.onChange(e);
......@@ -147,6 +146,10 @@ class AutosuggestTextarea extends React.Component {
}
}
reset () {
this.textarea.style.height = 'auto';
}
render () {
const { value, suggestions, disabled, placeholder, onKeyUp } = this.props;
const { suggestionsHidden, selectedSuggestion } = this.state;
......
......@@ -44,12 +44,12 @@ class ComposeForm extends React.PureComponent {
handleKeyDown (e) {
if (e.keyCode === 13 && (e.ctrlKey || e.metaKey)) {
this.props.onSubmit();
this.handleSubmit();
}
}
handleSubmit () {
this.autosuggestTextarea.textarea.style.height = "auto";
this.autosuggestTextarea.reset();
this.props.onSubmit();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment