mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 19:56:47 +03:00
fix: autocomplete to use tab instead of return
This commit is contained in:
parent
f431e62e6b
commit
1f9a396fa5
2 changed files with 4 additions and 17 deletions
|
@ -36,7 +36,6 @@ export default class MessageComposer extends React.Component {
|
||||||
this.onInputContentChanged = this.onInputContentChanged.bind(this);
|
this.onInputContentChanged = this.onInputContentChanged.bind(this);
|
||||||
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._tryComplete = this._tryComplete.bind(this);
|
this._tryComplete = this._tryComplete.bind(this);
|
||||||
this._onAutocompleteConfirm = this._onAutocompleteConfirm.bind(this);
|
this._onAutocompleteConfirm = this._onAutocompleteConfirm.bind(this);
|
||||||
|
|
||||||
|
@ -143,12 +142,6 @@ export default class MessageComposer extends React.Component {
|
||||||
return this.refs.autocomplete.onDownArrow();
|
return this.refs.autocomplete.onDownArrow();
|
||||||
}
|
}
|
||||||
|
|
||||||
onTab() {
|
|
||||||
// FIXME Autocomplete doesn't have an onTab - what is this supposed to do?
|
|
||||||
// return this.refs.autocomplete.onTab();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
_tryComplete(): boolean {
|
_tryComplete(): boolean {
|
||||||
if (this.refs.autocomplete) {
|
if (this.refs.autocomplete) {
|
||||||
return this.refs.autocomplete.onConfirm();
|
return this.refs.autocomplete.onConfirm();
|
||||||
|
@ -223,7 +216,6 @@ export default class MessageComposer extends React.Component {
|
||||||
tryComplete={this._tryComplete}
|
tryComplete={this._tryComplete}
|
||||||
onUpArrow={this.onUpArrow}
|
onUpArrow={this.onUpArrow}
|
||||||
onDownArrow={this.onDownArrow}
|
onDownArrow={this.onDownArrow}
|
||||||
onTab={this.onTab}
|
|
||||||
tabComplete={this.props.tabComplete} // used for old messagecomposerinput/tabcomplete
|
tabComplete={this.props.tabComplete} // used for old messagecomposerinput/tabcomplete
|
||||||
onContentChanged={this.onInputContentChanged} />,
|
onContentChanged={this.onInputContentChanged} />,
|
||||||
uploadButton,
|
uploadButton,
|
||||||
|
|
|
@ -423,12 +423,6 @@ export default class MessageComposerInput extends React.Component {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.props.tryComplete) {
|
|
||||||
if(this.props.tryComplete()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const contentState = this.state.editorState.getCurrentContent();
|
const contentState = this.state.editorState.getCurrentContent();
|
||||||
if (!contentState.hasText()) {
|
if (!contentState.hasText()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -519,8 +513,8 @@ export default class MessageComposerInput extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onTab(e) {
|
onTab(e) {
|
||||||
if (this.props.onTab) {
|
if (this.props.tryComplete) {
|
||||||
if (this.props.onTab()) {
|
if (this.props.tryComplete()) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -585,5 +579,6 @@ MessageComposerInput.propTypes = {
|
||||||
|
|
||||||
onDownArrow: React.PropTypes.func,
|
onDownArrow: React.PropTypes.func,
|
||||||
|
|
||||||
onTab: React.PropTypes.func
|
// attempts to confirm currently selected completion, returns whether actually confirmed
|
||||||
|
tryComplete: React.PropTypes.func,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue