Merge pull request #1287 from matrix-org/luke/fix-hide-autocomp-on-selection-change
Hide autocomplete when RTE selection state (cursor) changes
This commit is contained in:
commit
f4092cc9b4
1 changed files with 13 additions and 0 deletions
|
@ -457,6 +457,19 @@ export default class MessageComposerInput extends React.Component {
|
||||||
state.editorState = RichText.attachImmutableEntitiesToEmoji(
|
state.editorState = RichText.attachImmutableEntitiesToEmoji(
|
||||||
state.editorState);
|
state.editorState);
|
||||||
|
|
||||||
|
// Hide the autocomplete if the cursor location changes but the plaintext
|
||||||
|
// content stays the same. We don't hide if the pt has changed because the
|
||||||
|
// autocomplete will probably have different completions to show.
|
||||||
|
if (
|
||||||
|
!state.editorState.getSelection().equals(
|
||||||
|
this.state.editorState.getSelection()
|
||||||
|
)
|
||||||
|
&& state.editorState.getCurrentContent().getPlainText() ===
|
||||||
|
this.state.editorState.getCurrentContent().getPlainText()
|
||||||
|
) {
|
||||||
|
this.autocomplete.hide();
|
||||||
|
}
|
||||||
|
|
||||||
if (state.editorState.getCurrentContent().hasText()) {
|
if (state.editorState.getCurrentContent().hasText()) {
|
||||||
this.onTypingActivity();
|
this.onTypingActivity();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue