Implement composer completion user/room pill insertion

This modifies the composer completion such that completing a room or user will insert an IMMUTABLE matrix.to LINK Entity for the range that was replaced. Display names will not have a colon after their name anymore as it seemed strange that we would insert one after a pill.
This commit is contained in:
Luke Barnard 2017-07-17 15:53:29 +01:00
parent ee5117525c
commit 897ff05d87
4 changed files with 54 additions and 21 deletions

View file

@ -52,9 +52,16 @@ export default class RoomProvider extends AutocompleteProvider {
};
}));
completions = this.matcher.match(command[0]).map(room => {
let displayAlias = getDisplayAliasForRoom(room.room) || room.roomId;
const displayAlias = getDisplayAliasForRoom(room.room) || room.roomId;
return {
completion: displayAlias + ' ',
completion: displayAlias,
entity: {
type: 'LINK',
mutability: 'IMMUTABLE',
data: {
url: 'https://matrix.to/#/' + displayAlias,
},
},
component: (
<PillCompletion initialComponent={<RoomAvatar width={24} height={24} room={room.room} />} title={room.name} description={displayAlias} />
),