From 034f47205eea0ab32e88f9b0595943804e7e030f Mon Sep 17 00:00:00 2001
From: 1Step621 <86859447+1STEP621@users.noreply.github.com>
Date: Mon, 19 Feb 2024 08:36:06 +0900
Subject: [PATCH] =?UTF-8?q?Fix(frontend):=20=E3=82=AA=E3=83=BC=E3=83=88?=
 =?UTF-8?q?=E3=82=B3=E3=83=B3=E3=83=97=E3=83=AA=E3=83=BC=E3=83=88=E3=81=8C?=
 =?UTF-8?q?=E5=87=BA=E3=82=8B=E3=81=B9=E3=81=8D=E7=8A=B6=E6=B3=81=E3=81=A7?=
 =?UTF-8?q?=E5=87=BA=E3=81=AA=E3=81=84=E3=81=93=E3=81=A8=E3=81=8C=E3=81=82?=
 =?UTF-8?q?=E3=82=8B=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3=20=20(#13376)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* オートコンプリートが出るべき状況で出ないことがあるのを修正

* update CHANGELOG.md
---
 CHANGELOG.md                                  | 5 +++++
 packages/frontend/src/scripts/autocomplete.ts | 4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index ae1bd97ea..7c1eaa959 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -30,6 +30,11 @@
 ### Server
 - Fix: nodeinfoにenableMcaptchaとenableTurnstileが無いのを修正
 
+## 202x.x.x (unreleased)
+
+### Client
+- Fix: MFMのオートコンプリートが出るべき状況で出ないことがある問題を修正
+
 ## 2024.2.0
 
 ### Note
diff --git a/packages/frontend/src/scripts/autocomplete.ts b/packages/frontend/src/scripts/autocomplete.ts
index fe515d81a..9fc8f7843 100644
--- a/packages/frontend/src/scripts/autocomplete.ts
+++ b/packages/frontend/src/scripts/autocomplete.ts
@@ -93,9 +93,11 @@ export class Autocomplete {
 			return;
 		}
 
+		const afterLastMfmParam = text.split(/\$\[[a-zA-Z]+/).pop();
+
 		const isMention = mentionIndex !== -1;
 		const isHashtag = hashtagIndex !== -1;
-		const isMfmParam = mfmParamIndex !== -1 && text.split(/\$\[[a-zA-Z]+/).pop()?.includes('.');
+		const isMfmParam = mfmParamIndex !== -1 && afterLastMfmParam?.includes('.') && !afterLastMfmParam?.includes(' ');
 		const isMfmTag = mfmTagIndex !== -1 && !isMfmParam;
 		const isEmoji = emojiIndex !== -1 && text.split(/:[a-z0-9_+\-]+:/).pop()!.includes(':');