Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 1f9a396

Browse files
committed
fix: autocomplete to use tab instead of return
1 parent f431e62 commit 1f9a396

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

src/components/views/rooms/MessageComposer.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ export default class MessageComposer extends React.Component {
3636
this.onInputContentChanged = this.onInputContentChanged.bind(this);
3737
this.onUpArrow = this.onUpArrow.bind(this);
3838
this.onDownArrow = this.onDownArrow.bind(this);
39-
this.onTab = this.onTab.bind(this);
4039
this._tryComplete = this._tryComplete.bind(this);
4140
this._onAutocompleteConfirm = this._onAutocompleteConfirm.bind(this);
4241

@@ -143,12 +142,6 @@ export default class MessageComposer extends React.Component {
143142
return this.refs.autocomplete.onDownArrow();
144143
}
145144

146-
onTab() {
147-
// FIXME Autocomplete doesn't have an onTab - what is this supposed to do?
148-
// return this.refs.autocomplete.onTab();
149-
return false;
150-
}
151-
152145
_tryComplete(): boolean {
153146
if (this.refs.autocomplete) {
154147
return this.refs.autocomplete.onConfirm();
@@ -223,7 +216,6 @@ export default class MessageComposer extends React.Component {
223216
tryComplete={this._tryComplete}
224217
onUpArrow={this.onUpArrow}
225218
onDownArrow={this.onDownArrow}
226-
onTab={this.onTab}
227219
tabComplete={this.props.tabComplete} // used for old messagecomposerinput/tabcomplete
228220
onContentChanged={this.onInputContentChanged} />,
229221
uploadButton,

src/components/views/rooms/MessageComposerInput.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -422,12 +422,6 @@ export default class MessageComposerInput extends React.Component {
422422
if (ev.shiftKey) {
423423
return false;
424424
}
425-
426-
if(this.props.tryComplete) {
427-
if(this.props.tryComplete()) {
428-
return true;
429-
}
430-
}
431425

432426
const contentState = this.state.editorState.getCurrentContent();
433427
if (!contentState.hasText()) {
@@ -519,8 +513,8 @@ export default class MessageComposerInput extends React.Component {
519513
}
520514

521515
onTab(e) {
522-
if (this.props.onTab) {
523-
if (this.props.onTab()) {
516+
if (this.props.tryComplete) {
517+
if (this.props.tryComplete()) {
524518
e.preventDefault();
525519
}
526520
}
@@ -585,5 +579,6 @@ MessageComposerInput.propTypes = {
585579

586580
onDownArrow: React.PropTypes.func,
587581

588-
onTab: React.PropTypes.func
582+
// attempts to confirm currently selected completion, returns whether actually confirmed
583+
tryComplete: React.PropTypes.func,
589584
};

0 commit comments

Comments
 (0)