You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-30 02:21:17 +03:00
@ -17,8 +17,8 @@ export default class Autocomplete extends React.Component {
|
||||
super(props);
|
||||
|
||||
this.completionPromise = null;
|
||||
this.onConfirm = this.onConfirm.bind(this);
|
||||
this.hide = this.hide.bind(this);
|
||||
this.onCompletionClicked = this.onCompletionClicked.bind(this);
|
||||
|
||||
this.state = {
|
||||
// list of completionResults, each containing completions
|
||||
@ -157,16 +157,13 @@ export default class Autocomplete extends React.Component {
|
||||
return done.promise;
|
||||
}
|
||||
|
||||
/** called from MessageComposerInput
|
||||
* @returns {boolean} whether confirmation was handled
|
||||
*/
|
||||
onConfirm(): boolean {
|
||||
onCompletionClicked(): boolean {
|
||||
if (this.countCompletions() === 0 || this.state.selectionOffset === COMPOSER_SELECTED) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let selectedCompletion = this.state.completionList[this.state.selectionOffset - 1];
|
||||
this.props.onConfirm(selectedCompletion.range, selectedCompletion.completion);
|
||||
this.props.onConfirm(this.state.completionList[this.state.selectionOffset - 1]);
|
||||
this.hide();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -204,7 +201,7 @@ export default class Autocomplete extends React.Component {
|
||||
let onMouseOver = () => this.setSelection(componentPosition);
|
||||
let onClick = () => {
|
||||
this.setSelection(componentPosition);
|
||||
this.onConfirm();
|
||||
this.onCompletionClicked();
|
||||
};
|
||||
|
||||
return React.cloneElement(completion.component, {
|
||||
|
@ -178,7 +178,7 @@ export default class MessageComposer extends React.Component {
|
||||
|
||||
_tryComplete(): boolean {
|
||||
if (this.refs.autocomplete) {
|
||||
return this.refs.autocomplete.onConfirm();
|
||||
return this.refs.autocomplete.onCompletionClicked();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user