diff options
author | Claire <claire.github-309c@sitedethib.com> | 2021-12-16 16:19:28 +0100 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2021-12-16 16:20:44 +0100 |
commit | b2526316f54839968c821295e63066beaa425159 (patch) | |
tree | b13a52c19923edfb80518f82ac060f296e68aeb2 /app/javascript/mastodon/actions/compose.js | |
parent | d911c17f521d6b13861caa886715a50b644007a1 (diff) | |
parent | 2aafa5b4e7a83ce8195cd739f1233a52ab060db7 (diff) |
Merge branch 'main' into glitch-soc/merge-upstream
Conflicts: - `app/views/admin/pending_accounts/index.html.haml`: Removed upstream, while it had glitch-soc-specific changes to accomodate for glitch-soc's theming system. Removed the file. Additional changes: - `app/views/admin/accounts/index.html.haml': Accomodate for glitch-soc's theming system.
Diffstat (limited to 'app/javascript/mastodon/actions/compose.js')
-rw-r--r-- | app/javascript/mastodon/actions/compose.js | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/app/javascript/mastodon/actions/compose.js b/app/javascript/mastodon/actions/compose.js index 40d566d24..afd42bdef 100644 --- a/app/javascript/mastodon/actions/compose.js +++ b/app/javascript/mastodon/actions/compose.js @@ -37,6 +37,7 @@ export const THUMBNAIL_UPLOAD_PROGRESS = 'THUMBNAIL_UPLOAD_PROGRESS'; export const COMPOSE_SUGGESTIONS_CLEAR = 'COMPOSE_SUGGESTIONS_CLEAR'; export const COMPOSE_SUGGESTIONS_READY = 'COMPOSE_SUGGESTIONS_READY'; export const COMPOSE_SUGGESTION_SELECT = 'COMPOSE_SUGGESTION_SELECT'; +export const COMPOSE_SUGGESTION_IGNORE = 'COMPOSE_SUGGESTION_IGNORE'; export const COMPOSE_SUGGESTION_TAGS_UPDATE = 'COMPOSE_SUGGESTION_TAGS_UPDATE'; export const COMPOSE_TAG_HISTORY_UPDATE = 'COMPOSE_TAG_HISTORY_UPDATE'; @@ -536,13 +537,25 @@ export function selectComposeSuggestion(position, token, suggestion, path) { startPosition = position; } - dispatch({ - type: COMPOSE_SUGGESTION_SELECT, - position: startPosition, - token, - completion, - path, - }); + // 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 + // the suggestions are dismissed and the cursor moves forward. + if (suggestion.type !== 'hashtag' || token.slice(1).localeCompare(suggestion.name, undefined, { sensitivity: 'accent' }) !== 0) { + dispatch({ + type: COMPOSE_SUGGESTION_SELECT, + position: startPosition, + token, + completion, + path, + }); + } else { + dispatch({ + type: COMPOSE_SUGGESTION_IGNORE, + position: startPosition, + token, + completion, + path, + }); + } }; }; |