You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-20 16:22:28 +03:00
only capture enter if something was selected in completions
This commit is contained in:
@@ -162,6 +162,10 @@ export default class Autocomplete extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hasSelection(): bool {
|
||||||
|
return this.countCompletions() > 0 && this.state.selectionOffset !== 0;
|
||||||
|
}
|
||||||
|
|
||||||
countCompletions(): number {
|
countCompletions(): number {
|
||||||
return this.state.completionList.length;
|
return this.state.completionList.length;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -989,7 +989,7 @@ export default class MessageComposerInput extends React.Component {
|
|||||||
return change.insertText('\n');
|
return change.insertText('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.autocomplete.countCompletions() > 0) {
|
if (this.autocomplete.hasSelection()) {
|
||||||
this.autocomplete.hide();
|
this.autocomplete.hide();
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user