You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-07 10:46:24 +03:00
Merge pull request #3375 from matrix-org/bwindels/cider-colononmention
New composer: share user pill postfix between autocomplete and insert mention
This commit is contained in:
@@ -290,11 +290,12 @@ export default class SendMessageComposer extends React.Component {
|
||||
const member = this.props.room.getMember(userId);
|
||||
const displayName = member ?
|
||||
member.rawDisplayName : userId;
|
||||
const userPillPart = partCreator.userPill(displayName, userId);
|
||||
const caret = this._editorRef.getCaret();
|
||||
const position = model.positionForOffset(caret.offset, caret.atNodeEnd);
|
||||
const insertIndex = position.index + 1;
|
||||
const parts = partCreator.createMentionParts(insertIndex, displayName, userId);
|
||||
model.transform(() => {
|
||||
const addedLen = model.insert([userPillPart], position);
|
||||
const addedLen = model.insert(parts, position);
|
||||
return model.positionForOffset(caret.offset + addedLen, true);
|
||||
});
|
||||
// refocus on composer, as we just clicked "Mention"
|
||||
|
||||
Reference in New Issue
Block a user