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:
Bruno Windels 2019-09-02 14:58:23 +00:00 committed by GitHub
commit c4d7df768d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 5 deletions

View file

@ -106,9 +106,7 @@ export default class AutocompleteWrapperModel {
if (completionId === "@room") {
return [this._partCreator.atRoomPill(completionId)];
} else {
const pill = this._partCreator.userPill(text, completionId);
const postfix = this._partCreator.plain(this._partIndex === 0 ? ": " : " ");
return [pill, postfix];
return this._partCreator.createMentionParts(this._partIndex, text, completionId);
}
}
case "#":

View file

@ -442,6 +442,12 @@ export class PartCreator {
const member = this._room.getMember(userId);
return new UserPillPart(userId, displayName, member);
}
createMentionParts(partIndex, displayName, userId) {
const pill = this.userPill(displayName, userId);
const postfix = this.plain(partIndex === 0 ? ": " : " ");
return [pill, postfix];
}
}
// part creator that support auto complete for /commands,