mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 19:56:47 +03:00
Fix warnings from MessageComposer
Fix a couple of warnings from React about required properties not being set.
This commit is contained in:
parent
1b38398156
commit
e63a32dc10
1 changed files with 20 additions and 3 deletions
|
@ -37,6 +37,8 @@ export default class MessageComposer extends React.Component {
|
||||||
this.onUpArrow = this.onUpArrow.bind(this);
|
this.onUpArrow = this.onUpArrow.bind(this);
|
||||||
this.onDownArrow = this.onDownArrow.bind(this);
|
this.onDownArrow = this.onDownArrow.bind(this);
|
||||||
this.onTab = this.onTab.bind(this);
|
this.onTab = this.onTab.bind(this);
|
||||||
|
this._tryComplete = this._tryComplete.bind(this);
|
||||||
|
this._onAutocompleteConfirm = this._onAutocompleteConfirm.bind(this);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
autocompleteQuery: '',
|
autocompleteQuery: '',
|
||||||
|
@ -142,7 +144,22 @@ export default class MessageComposer extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onTab() {
|
onTab() {
|
||||||
return this.refs.autocomplete.onTab();
|
// FIXME Autocomplete doesn't have an onTab - what is this supposed to do?
|
||||||
|
// return this.refs.autocomplete.onTab();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_tryComplete(): boolean {
|
||||||
|
if (this.refs.autocomplete) {
|
||||||
|
return this.refs.autocomplete.onConfirm();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_onAutocompleteConfirm(range, completion) {
|
||||||
|
if (this.messageComposerInput) {
|
||||||
|
this.messageComposerInput.onConfirmAutocompletion(range, completion);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -203,7 +220,7 @@ export default class MessageComposer extends React.Component {
|
||||||
key="controls_input"
|
key="controls_input"
|
||||||
onResize={this.props.onResize}
|
onResize={this.props.onResize}
|
||||||
room={this.props.room}
|
room={this.props.room}
|
||||||
tryComplete={this.refs.autocomplete && this.refs.autocomplete.onConfirm}
|
tryComplete={this._tryComplete}
|
||||||
onUpArrow={this.onUpArrow}
|
onUpArrow={this.onUpArrow}
|
||||||
onDownArrow={this.onDownArrow}
|
onDownArrow={this.onDownArrow}
|
||||||
onTab={this.onTab}
|
onTab={this.onTab}
|
||||||
|
@ -227,7 +244,7 @@ export default class MessageComposer extends React.Component {
|
||||||
<div className="mx_MessageComposer_autocomplete_wrapper">
|
<div className="mx_MessageComposer_autocomplete_wrapper">
|
||||||
<Autocomplete
|
<Autocomplete
|
||||||
ref="autocomplete"
|
ref="autocomplete"
|
||||||
onConfirm={this.messageComposerInput && this.messageComposerInput.onConfirmAutocompletion}
|
onConfirm={this._onAutocompleteConfirm}
|
||||||
query={this.state.autocompleteQuery}
|
query={this.state.autocompleteQuery}
|
||||||
selection={this.state.selection} />
|
selection={this.state.selection} />
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue