0
0
Fork 0

Add autosuggestions for hashtags (#11422)

This commit is contained in:
Eugen Rochko 2019-07-28 14:37:52 +02:00 committed by GitHub
parent 15de24a425
commit cfb2ed7823
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 107 additions and 27 deletions

View file

@ -1,6 +1,7 @@
import React from 'react';
import AutosuggestAccountContainer from '../features/compose/containers/autosuggest_account_container';
import AutosuggestEmoji from './autosuggest_emoji';
import AutosuggestHashtag from './autosuggest_hashtag';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import { isRtl } from '../rtl';
@ -173,12 +174,12 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
const { selectedSuggestion } = this.state;
let inner, key;
if (typeof suggestion === 'object') {
if (typeof suggestion === 'object' && suggestion.shortcode) {
inner = <AutosuggestEmoji emoji={suggestion} />;
key = suggestion.id;
} else if (suggestion[0] === '#') {
inner = suggestion;
key = suggestion;
} else if (typeof suggestion === 'object' && suggestion.name) {
inner = <AutosuggestHashtag tag={suggestion} />;
key = suggestion.name;
} else {
inner = <AutosuggestAccountContainer id={suggestion} />;
key = suggestion;