mirror of https://github.com/vector-im/riot-web
post-merge fixup
parent
d8acc0612a
commit
a757f589bd
|
@ -726,9 +726,8 @@ export default class BasicMessageEditor extends React.Component<IProps, IState>
|
|||
member.rawDisplayName : userId;
|
||||
const caret = this.getCaret();
|
||||
const position = model.positionForOffset(caret.offset, caret.atNodeEnd);
|
||||
// index is -1 if there are no parts but we only care for if this would be the part in position 0
|
||||
const insertIndex = position.index > 0 ? position.index : 0;
|
||||
const parts = partCreator.createMentionParts(insertIndex, displayName, userId);
|
||||
// Insert suffix only if the caret is at the start of the composer
|
||||
const parts = partCreator.createMentionParts(caret.offset === 0, displayName, userId);
|
||||
model.transform(() => {
|
||||
const addedLen = model.insert(parts, position);
|
||||
return model.positionForOffset(caret.offset + addedLen, true);
|
||||
|
|
Loading…
Reference in New Issue