mirror of https://github.com/vector-im/riot-web
Fix tests (wip)
parent
b62622a814
commit
fbf2d5f96c
|
@ -18,7 +18,6 @@ export default class AutocompleteProvider {
|
||||||
let commandRegex = this.commandRegex;
|
let commandRegex = this.commandRegex;
|
||||||
|
|
||||||
if (force && this.shouldForceComplete()) {
|
if (force && this.shouldForceComplete()) {
|
||||||
console.log('forcing complete');
|
|
||||||
commandRegex = /[^\W]+/g;
|
commandRegex = /[^\W]+/g;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,11 +11,11 @@ import {getCompletions} from '../../../autocomplete/Autocompleter';
|
||||||
const COMPOSER_SELECTED = 0;
|
const COMPOSER_SELECTED = 0;
|
||||||
|
|
||||||
export default class Autocomplete extends React.Component {
|
export default class Autocomplete extends React.Component {
|
||||||
completionPromise: Promise = null;
|
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
|
this.completionPromise = null;
|
||||||
this.onConfirm = this.onConfirm.bind(this);
|
this.onConfirm = this.onConfirm.bind(this);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
|
|
|
@ -394,12 +394,12 @@ export default class MessageComposerInput extends React.Component {
|
||||||
onEditorContentChanged(editorState: EditorState, didRespondToUserInput: boolean = true) {
|
onEditorContentChanged(editorState: EditorState, didRespondToUserInput: boolean = true) {
|
||||||
editorState = RichText.attachImmutableEntitiesToEmoji(editorState);
|
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 */
|
/* If a modification was made, set originalEditorState to null, since newState is now our original */
|
||||||
this.setState({
|
this.setState({
|
||||||
editorState,
|
editorState,
|
||||||
originalEditorState: didRespondToUserInput ? null : this.state.originalEditorState,
|
originalEditorState: didRespondToUserInput ? null : this.state.originalEditorState,
|
||||||
}, () => setPromise.resolve());
|
}, () => contentChanged.resolve());
|
||||||
|
|
||||||
if (editorState.getCurrentContent().hasText()) {
|
if (editorState.getCurrentContent().hasText()) {
|
||||||
this.onTypingActivity();
|
this.onTypingActivity();
|
||||||
|
@ -414,11 +414,11 @@ export default class MessageComposerInput extends React.Component {
|
||||||
|
|
||||||
this.props.onContentChanged(textContent, selection);
|
this.props.onContentChanged(textContent, selection);
|
||||||
}
|
}
|
||||||
return setPromise;
|
return contentChanged.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
setEditorState(editorState: EditorState) {
|
setEditorState(editorState: EditorState) {
|
||||||
this.onEditorContentChanged(editorState, false);
|
return this.onEditorContentChanged(editorState, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
enableRichtext(enabled: boolean) {
|
enableRichtext(enabled: boolean) {
|
||||||
|
@ -434,13 +434,13 @@ export default class MessageComposerInput extends React.Component {
|
||||||
contentState = ContentState.createFromText(markdown);
|
contentState = ContentState.createFromText(markdown);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setEditorState(this.createEditorState(enabled, contentState), () => {
|
this.setEditorState(this.createEditorState(enabled, contentState)).then(() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
isRichtextEnabled: enabled,
|
isRichtextEnabled: enabled,
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
UserSettingsStore.setSyncedSetting('MessageComposerInput.isRichTextEnabled', enabled);
|
UserSettingsStore.setSyncedSetting('MessageComposerInput.isRichTextEnabled', enabled);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
handleKeyCommand(command: string): boolean {
|
handleKeyCommand(command: string): boolean {
|
||||||
|
|
Loading…
Reference in New Issue