fix: case-insensitive UUID matching in preprocessItemMentions

UUIDs can contain both uppercase and lowercase hex characters (A-F, a-f).
The regex was only matching lowercase, causing @mentions to not be
converted to links in TextViewStatic.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Anton Tranelis 2026-01-14 16:58:15 +01:00
parent b944a7f401
commit b40b6c8160

View File

@ -130,15 +130,16 @@ export function preprocessItemMentions(text: string): string {
// Format with layer: [@Label](/item/layer/id) or [@Label](item/layer/id)
// Use non-greedy matching for label to handle consecutive mentions
// Use case-insensitive flag for UUID hex characters
result = result.replace(
/\[@([^\]]+?)\]\(\/?item\/[^/]+\/([a-f0-9-]+)\)/g,
/\[@([^\]]+?)\]\(\/?item\/[^/]+\/([a-fA-F0-9-]+)\)/g,
'<span data-item-mention data-label="$1" data-id="$2">@$1</span>',
)
// Format without layer: [@Label](/item/id) or [@Label](item/id)
// UUID pattern: hex characters with dashes
// UUID pattern: hex characters (case-insensitive) with dashes
result = result.replace(
/\[@([^\]]+?)\]\(\/?item\/([a-f0-9-]+)\)/g,
/\[@([^\]]+?)\]\(\/?item\/([a-fA-F0-9-]+)\)/g,
'<span data-item-mention data-label="$1" data-id="$2">@$1</span>',
)