0
0
Fork 0

Implement tag auto-completion by history (#6621)

This is a functionality similar to one implemented in Pawoo:
21a3c70f80
This commit is contained in:
Akihiko Odaki 2018-03-05 04:27:25 +09:00 committed by Eugen Rochko
parent 778b37790b
commit 460e380d38
5 changed files with 95 additions and 7 deletions

View file

@ -20,7 +20,7 @@ const textAtCursorMatchesToken = (str, caretPosition) => {
word = str.slice(left, right + caretPosition);
}
if (!word || word.trim().length < 3 || ['@', ':'].indexOf(word[0]) === -1) {
if (!word || word.trim().length < 3 || ['@', ':', '#'].indexOf(word[0]) === -1) {
return [null, null];
}
@ -170,6 +170,9 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
if (typeof suggestion === 'object') {
inner = <AutosuggestEmoji emoji={suggestion} />;
key = suggestion.id;
} else if (suggestion[0] === '#') {
inner = suggestion;
key = suggestion;
} else {
inner = <AutosuggestAccountContainer id={suggestion} />;
key = suggestion;