diff --git a/src/autocomplete/AutocompleteProvider.js b/src/autocomplete/AutocompleteProvider.js index 137367194c..7335262a24 100644 --- a/src/autocomplete/AutocompleteProvider.js +++ b/src/autocomplete/AutocompleteProvider.js @@ -18,7 +18,6 @@ export default class AutocompleteProvider { let commandRegex = this.commandRegex; if (force && this.shouldForceComplete()) { - console.log('forcing complete'); commandRegex = /[^\W]+/g; } diff --git a/src/components/views/rooms/Autocomplete.js b/src/components/views/rooms/Autocomplete.js index 7ac138568c..2893ad6823 100644 --- a/src/components/views/rooms/Autocomplete.js +++ b/src/components/views/rooms/Autocomplete.js @@ -11,11 +11,11 @@ import {getCompletions} from '../../../autocomplete/Autocompleter'; const COMPOSER_SELECTED = 0; export default class Autocomplete extends React.Component { - completionPromise: Promise = null; constructor(props) { super(props); + this.completionPromise = null; this.onConfirm = this.onConfirm.bind(this); this.state = { diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 945771a12c..be13cca549 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -394,12 +394,12 @@ export default class MessageComposerInput extends React.Component { onEditorContentChanged(editorState: EditorState, didRespondToUserInput: boolean = true) { editorState = RichText.attachImmutableEntitiesToEmoji(editorState); - const setPromise = Q.defer(); + const contentChanged = Q.defer(); /* If a modification was made, set originalEditorState to null, since newState is now our original */ this.setState({ editorState, originalEditorState: didRespondToUserInput ? null : this.state.originalEditorState, - }, () => setPromise.resolve()); + }, () => contentChanged.resolve()); if (editorState.getCurrentContent().hasText()) { this.onTypingActivity(); @@ -414,11 +414,11 @@ export default class MessageComposerInput extends React.Component { this.props.onContentChanged(textContent, selection); } - return setPromise; + return contentChanged.promise; } setEditorState(editorState: EditorState) { - this.onEditorContentChanged(editorState, false); + return this.onEditorContentChanged(editorState, false); } enableRichtext(enabled: boolean) { @@ -434,13 +434,13 @@ export default class MessageComposerInput extends React.Component { contentState = ContentState.createFromText(markdown); } - this.setEditorState(this.createEditorState(enabled, contentState), () => { + this.setEditorState(this.createEditorState(enabled, contentState)).then(() => { this.setState({ isRichtextEnabled: enabled, }); - }); - UserSettingsStore.setSyncedSetting('MessageComposerInput.isRichTextEnabled', enabled); + UserSettingsStore.setSyncedSetting('MessageComposerInput.isRichTextEnabled', enabled); + }); } handleKeyCommand(command: string): boolean {