fix some bugs i think ?

This commit is contained in:
Henry Hiles 2026-01-06 12:08:34 -05:00
commit cb5846600b
No known key found for this signature in database
6 changed files with 43 additions and 34 deletions

View file

@ -201,12 +201,15 @@ class RoomChat extends HookConsumerWidget {
(
context,
message, {
required details,
required index,
}) => context.showContextMenu(
globalPosition: details.globalPosition,
children: getMessageOptions(message),
),
TapUpDetails? details,
}) => details?.globalPosition == null
? null
: context.showContextMenu(
globalPosition:
details!.globalPosition,
children: getMessageOptions(message),
),
onMessageLongPress:
(
context,
@ -246,11 +249,18 @@ class RoomChat extends HookConsumerWidget {
as String)
.replaceAllMapped(
RegExp(
regexLink,
"(<a\\b[^>]*>.*?<\\/a>)|(\\bhttps?:\\/\\/[^\\s<]+)",
caseSensitive: false,
),
(m) =>
"<a href=\"${m.group(0)!}\">${m.group(0)!}</a>",
(m) {
// If it's already an <a> tag, leave it unchanged
if (m.group(1) != null)
return m.group(1)!;
// Otherwise, wrap the bare URL
final url = m.group(2)!;
return "<a href=\"$url\">$url</a>";
},
)
.replaceAll("\n", "<br/>") +
((message.editedAt != null)