From 04855f920144cd3d040d9896157f186c1ceebc88 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 21 Aug 2021 10:29:26 +0900 Subject: [PATCH] enhance(client): Improve emoji autocomplete behaviour cherry picked from https://github.com/kat-atat/misskey/commit/4b2c215e25a0bae47f4375b296d1f5d07a179f88 --- CHANGELOG.md | 3 ++- src/client/scripts/autocomplete.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47372dda5..e77ee9b24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,9 +10,10 @@ ## 12.x.x (unreleased) ### Improvements -- 依存関係の更新 +- 絵文字オートコンプリートの挙動を改修 - localStorageのaccountsはindexedDBで保持するように - ActivityPub: ジョブキューの試行タイミングを調整 (#7635) +- 依存関係の更新 ### Bugfixes - チャンネルを作成しているとアカウントを削除できないのを修正 diff --git a/src/client/scripts/autocomplete.ts b/src/client/scripts/autocomplete.ts index 99c54c69c..924d6a62e 100644 --- a/src/client/scripts/autocomplete.ts +++ b/src/client/scripts/autocomplete.ts @@ -65,7 +65,7 @@ export class Autocomplete { */ private onInput() { const caretPos = this.textarea.selectionStart; - const text = this.text.substr(0, caretPos).split('\n').pop(); + const text = this.text.substr(0, caretPos).split('\n').pop()!; const mentionIndex = text.lastIndexOf('@'); const hashtagIndex = text.lastIndexOf('#'); @@ -83,7 +83,7 @@ export class Autocomplete { const isMention = mentionIndex != -1; const isHashtag = hashtagIndex != -1; - const isEmoji = emojiIndex != -1; + const isEmoji = emojiIndex != -1 && text.split(/:[a-z0-9_+\-]+:/).pop()!.includes(':'); let opened = false;