You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-11 20:22:36 +03:00
hide autocomplete when moving caret to match existing behaviour
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@@ -115,6 +115,15 @@ function onSendMessageFailed(err, room) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function rangeEquals(a: Range, b: Range): boolean {
|
||||||
|
return (a.anchorKey === b.anchorKey
|
||||||
|
&& a.anchorOffset === b.anchorOffset
|
||||||
|
&& a.focusKey === b.focusKey
|
||||||
|
&& a.focusOffset === b.focusOffset
|
||||||
|
&& a.isFocused === b.isFocused
|
||||||
|
&& a.isBackward === b.isBackward);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The textInput part of the MessageComposer
|
* The textInput part of the MessageComposer
|
||||||
*/
|
*/
|
||||||
@@ -469,8 +478,7 @@ export default class MessageComposerInput extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onChange = (change: Change, originalEditorState: value) => {
|
onChange = (change: Change, originalEditorState?: Value) => {
|
||||||
|
|
||||||
let editorState = change.value;
|
let editorState = change.value;
|
||||||
|
|
||||||
if (this.direction !== '') {
|
if (this.direction !== '') {
|
||||||
@@ -490,6 +498,11 @@ export default class MessageComposerInput extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// when selection changes hide the autocomplete
|
||||||
|
if (!rangeEquals(this.state.editorState.selection, editorState.selection)) {
|
||||||
|
this.autocomplete.hide();
|
||||||
|
}
|
||||||
|
|
||||||
if (!editorState.document.isEmpty) {
|
if (!editorState.document.isEmpty) {
|
||||||
this.onTypingActivity();
|
this.onTypingActivity();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user