Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3886 from matrix-org/t3chguy/insert_mention_colon
Browse files Browse the repository at this point in the history
Fix click-to-ping not inserting colon if composer non-empty
  • Loading branch information
t3chguy authored Jan 21, 2020
2 parents adec308 + f56a9d2 commit ddfed32
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/views/rooms/SendMessageComposer.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,8 @@ export default class SendMessageComposer extends React.Component {
member.rawDisplayName : userId;
const caret = this._editorRef.getCaret();
const position = model.positionForOffset(caret.offset, caret.atNodeEnd);
const insertIndex = position.index + 1;
// 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);
model.transform(() => {
const addedLen = model.insert(parts, position);
Expand Down

0 comments on commit ddfed32

Please sign in to comment.