mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-24 13:35:07 +01:00
Reset textarea height when press submit key (#2681)
* Reset textarea height when press submit key * dry * DON'T NEED props
This commit is contained in:
parent
302c0d2046
commit
46943b64c6
@ -58,7 +58,6 @@ class AutosuggestTextarea extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// auto-resize textarea
|
// auto-resize textarea
|
||||||
e.target.style.height = 'auto';
|
|
||||||
e.target.style.height = `${e.target.scrollHeight}px`;
|
e.target.style.height = `${e.target.scrollHeight}px`;
|
||||||
|
|
||||||
this.props.onChange(e);
|
this.props.onChange(e);
|
||||||
@ -147,6 +146,10 @@ class AutosuggestTextarea extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reset () {
|
||||||
|
this.textarea.style.height = 'auto';
|
||||||
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { value, suggestions, disabled, placeholder, onKeyUp } = this.props;
|
const { value, suggestions, disabled, placeholder, onKeyUp } = this.props;
|
||||||
const { suggestionsHidden, selectedSuggestion } = this.state;
|
const { suggestionsHidden, selectedSuggestion } = this.state;
|
||||||
|
@ -44,12 +44,12 @@ class ComposeForm extends React.PureComponent {
|
|||||||
|
|
||||||
handleKeyDown (e) {
|
handleKeyDown (e) {
|
||||||
if (e.keyCode === 13 && (e.ctrlKey || e.metaKey)) {
|
if (e.keyCode === 13 && (e.ctrlKey || e.metaKey)) {
|
||||||
this.props.onSubmit();
|
this.handleSubmit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSubmit () {
|
handleSubmit () {
|
||||||
this.autosuggestTextarea.textarea.style.height = "auto";
|
this.autosuggestTextarea.reset();
|
||||||
this.props.onSubmit();
|
this.props.onSubmit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user