This makes sure the selection state is correct when moving the cursor through an entity in the composer but only in rich text mode. https://github.com/vector-im/riot-web/issues/4666 still persists despite this, probably because the text content inserted during a completion in markdown mode has a different length to the text node within the entity.
fixesvector-im/riot-web#4654
Instead of relying on the local avatar/displayname of a user, request the data from the server and update the pill if it shows up.
This required a slight refactor which means we're not doing everything in `render` now. Also I noticed unknown rooms weren't being rendered _at all_! So now you get something that looks like a normal link but with the room alias/ID in it.
Tab-completed @Mentions should only be sent as display names in the `body` of the event. The HTML should be unaffected, and always sent as an anchor tag.
Instead of blindly stripping all MD mentions, only strip those that were tab-completed. We do this by adding the `isCompleted` flag to the Entity data.
this is needed so that if a client which does not hide any events
sets and RM at bottom of timeline, then riot-web which hides events
sets the RM it'd set it at X-N where X is bottom and N is the amount of
hidden events at bottom of the timeline, this way now an RM will
fall through to the hidden events below a seen event.
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This isn't an entirely side-effect-free refactoring:
- the text of the timeline pills is now either the room ID/alias or user ID/ display name of the linked resource (which means that until we do a roundtrip to get user displaynames, mentions for users not in the current room will have their user IDs shown instead of what was in the link body).
- timeline links to rooms without avatars are now rendered as links
- fixed issue that would throw an error whilst rendering (i.e. unusable client) a room link to a room that the client doesn't know about
This isn't an entirely side-effect-free refactoring:
- the text of the timeline pills is now either the room ID/alias or user ID/ display name of the linked resource (which means that until we do a roundtrip to get user displaynames, mentions for users not in the current room will have their user IDs shown instead of what was in the link body).
- timeline links to rooms without avatars are now rendered as links
- fixed issue that would throw an error whilst rendering (i.e. unusable client) a room link to a room that the client doesn't know about