diff options
| author | dakkar <dakkar@thenautilus.net> | 2024-03-09 12:17:48 +0000 |
|---|---|---|
| committer | dakkar <dakkar@thenautilus.net> | 2024-03-09 12:51:51 +0000 |
| commit | 354cb2a6754b55fd3ad01388a4a17d3a76d4a09b (patch) | |
| tree | cd7040bef28cc321207c4ff15e202f9557c535cd /packages/frontend/src/scripts | |
| parent | merge: Feature/maybe nicer dockerfile (!463) (diff) | |
| download | sharkey-354cb2a6754b55fd3ad01388a4a17d3a76d4a09b.tar.gz sharkey-354cb2a6754b55fd3ad01388a4a17d3a76d4a09b.tar.bz2 sharkey-354cb2a6754b55fd3ad01388a4a17d3a76d4a09b.zip | |
handle non-ASCII emoji names
* use the more inclusive regexp for validating emoji names
* always normalize emoji names, aliases, categories
the latter point is necessary to allow matching, for example, `รค`
against `a`+combining diaeresis
this will also need to bump the version of `sfm-js` once we merge
https://activitypub.software/TransFem-org/sfm-js/-/merge_requests/2
Diffstat (limited to 'packages/frontend/src/scripts')
| -rw-r--r-- | packages/frontend/src/scripts/autocomplete.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/packages/frontend/src/scripts/autocomplete.ts b/packages/frontend/src/scripts/autocomplete.ts index 9fc8f7843e..d942402ffc 100644 --- a/packages/frontend/src/scripts/autocomplete.ts +++ b/packages/frontend/src/scripts/autocomplete.ts @@ -99,7 +99,7 @@ export class Autocomplete { const isHashtag = hashtagIndex !== -1; const isMfmParam = mfmParamIndex !== -1 && afterLastMfmParam?.includes('.') && !afterLastMfmParam?.includes(' '); const isMfmTag = mfmTagIndex !== -1 && !isMfmParam; - const isEmoji = emojiIndex !== -1 && text.split(/:[a-z0-9_+\-]+:/).pop()!.includes(':'); + const isEmoji = emojiIndex !== -1 && text.split(/:[\p{Letter}\p{Number}\p{Mark}_+-]+:/u).pop()!.includes(':'); let opened = false; @@ -125,7 +125,7 @@ export class Autocomplete { if (isEmoji && !opened && this.onlyType.includes('emoji')) { const emoji = text.substring(emojiIndex + 1); if (!emoji.includes(' ')) { - this.open('emoji', emoji); + this.open('emoji', emoji.normalize('NFC')); opened = true; } } |