post-merge fixup

pull/21833/head
Michael Telatynski 2021-05-24 21:57:59 +01:00
parent d8acc0612a
commit a757f589bd
1 changed files with 2 additions and 3 deletions

View File

@ -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);