From 1743c047bd66366779b80defdb3f2f7534ae7233 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 8 Aug 2017 10:28:11 +0100 Subject: [PATCH] Use the rawDisplayName for the user provider completion to make sure that the length of text in the decoration (See ) is equal to the length of text in the completion (underlying text range that the Entity covers). --- src/autocomplete/UserProvider.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/autocomplete/UserProvider.js b/src/autocomplete/UserProvider.js index 9c93cf537f..499ddb51ce 100644 --- a/src/autocomplete/UserProvider.js +++ b/src/autocomplete/UserProvider.js @@ -54,7 +54,9 @@ export default class UserProvider extends AutocompleteProvider { completions = this.matcher.match(command[0]).map((user) => { const displayName = (user.name || user.userId || '').replace(' (IRC)', ''); // FIXME when groups are done return { - completion: displayName, + // Length of completion should equal length of text in decorator. draft-js + // relies on the length of the entity === length of the text in the decoration. + completion: user.rawDisplayName, suffix: range.start === 0 ? ': ' : ' ', href: 'https://matrix.to/#/' + user.userId, component: (