|
|
|
@ -622,6 +622,7 @@ export function fetchComposeSuggestions(token) {
|
|
|
|
fetchComposeSuggestionsEmojis(dispatch, getState, token);
|
|
|
|
fetchComposeSuggestionsEmojis(dispatch, getState, token);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case '#':
|
|
|
|
case '#':
|
|
|
|
|
|
|
|
case '#':
|
|
|
|
fetchComposeSuggestionsTags(dispatch, getState, token);
|
|
|
|
fetchComposeSuggestionsTags(dispatch, getState, token);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
@ -663,11 +664,11 @@ export function selectComposeSuggestion(position, token, suggestion, path) {
|
|
|
|
|
|
|
|
|
|
|
|
dispatch(useEmoji(suggestion));
|
|
|
|
dispatch(useEmoji(suggestion));
|
|
|
|
} else if (suggestion.type === 'hashtag') {
|
|
|
|
} else if (suggestion.type === 'hashtag') {
|
|
|
|
completion = `#${suggestion.name}`;
|
|
|
|
completion = suggestion.name.slice(token.length - 1);
|
|
|
|
startPosition = position - 1;
|
|
|
|
startPosition = position + token.length;
|
|
|
|
} else if (suggestion.type === 'account') {
|
|
|
|
} else if (suggestion.type === 'account') {
|
|
|
|
completion = getState().getIn(['accounts', suggestion.id, 'acct']);
|
|
|
|
completion = `@${getState().getIn(['accounts', suggestion.id, 'acct'])}`;
|
|
|
|
startPosition = position;
|
|
|
|
startPosition = position - 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// We don't want to replace hashtags that vary only in case due to accessibility, but we need to fire off an event so that
|
|
|
|
// We don't want to replace hashtags that vary only in case due to accessibility, but we need to fire off an event so that
|
|
|
|
@ -727,7 +728,7 @@ function insertIntoTagHistory(recognizedTags, text) {
|
|
|
|
// complicated because of new normalization rules, it's no longer just
|
|
|
|
// complicated because of new normalization rules, it's no longer just
|
|
|
|
// a case sensitivity issue
|
|
|
|
// a case sensitivity issue
|
|
|
|
const names = recognizedTags.map(tag => {
|
|
|
|
const names = recognizedTags.map(tag => {
|
|
|
|
const matches = text.match(new RegExp(`#${tag.name}`, 'i'));
|
|
|
|
const matches = text.match(new RegExp(`[##]${tag.name}`, 'i'));
|
|
|
|
|
|
|
|
|
|
|
|
if (matches && matches.length > 0) {
|
|
|
|
if (matches && matches.length > 0) {
|
|
|
|
return matches[0].slice(1);
|
|
|
|
return matches[0].slice(1);
|
|
|
|
|