fix insert_mention

pull/21833/head
Matthew Hodgson 2018-05-13 22:41:39 +01:00
parent dd0726f068
commit ddfe0691c4
1 changed files with 17 additions and 16 deletions

View File

@ -243,23 +243,24 @@ export default class MessageComposerInput extends React.Component {
case 'focus_composer': case 'focus_composer':
editor.focus(); editor.focus();
break; break;
/* case 'insert_mention':
case 'insert_mention': { {
// Pretend that we've autocompleted this user because keeping two code // Pretend that we've autocompleted this user because keeping two code
// paths for inserting a user pill is not fun // paths for inserting a user pill is not fun
const selection = this.state.editorState.getSelection(); const selection = this.getSelectionRange(this.state.editorState);
const member = this.props.room.getMember(payload.user_id); const member = this.props.room.getMember(payload.user_id);
const completion = member ? const completion = member ?
member.rawDisplayName.replace(' (IRC)', '') : payload.user_id; member.rawDisplayName.replace(' (IRC)', '') : payload.user_id;
this.setDisplayedCompletion({ this.setDisplayedCompletion({
completion, completion,
completionId: payload.user_id,
selection, selection,
href: makeUserPermalink(payload.user_id), href: makeUserPermalink(payload.user_id),
suffix: selection.getStartOffset() === 0 ? ': ' : ' ', suffix: (selection.beginning && selection.start === 0) ? ': ' : ' ',
}); });
} }
break; break;
/*
case 'quote': { // old quoting, whilst rich quoting is in labs case 'quote': { // old quoting, whilst rich quoting is in labs
/// XXX: Not doing rich-text quoting from formatted-body because draft-js /// XXX: Not doing rich-text quoting from formatted-body because draft-js
/// has regressed such that when links are quoted, errors are thrown. See /// has regressed such that when links are quoted, errors are thrown. See