💄 Fixes and improvements
This commit is contained in:
@ -239,7 +239,7 @@ class _ChatMessageInputState extends State<ChatMessageInput> {
|
||||
if (suggestion.type == 'emotes') {
|
||||
insertText = suggestion.content;
|
||||
startText = replaceText.replaceFirstMapped(
|
||||
RegExp(r':(?:([a-z0-9_+-]+)~)?([a-z0-9_+-]+)$'),
|
||||
RegExp(r':(?:([-\w]+)~)?([-\w]+)$'),
|
||||
(Match m) => insertText,
|
||||
);
|
||||
}
|
||||
@ -247,7 +247,7 @@ class _ChatMessageInputState extends State<ChatMessageInput> {
|
||||
if (suggestion.type == 'users') {
|
||||
insertText = suggestion.content;
|
||||
startText = replaceText.replaceFirstMapped(
|
||||
RegExp(r'(?:\s|^)@([a-z0-9_+-]+)$'),
|
||||
RegExp(r'(?:\s|^)@([-\w]+)$'),
|
||||
(Match m) => insertText,
|
||||
);
|
||||
}
|
||||
@ -349,15 +349,17 @@ class _ChatMessageInputState extends State<ChatMessageInput> {
|
||||
final searchText = _textController.text
|
||||
.substring(0, _textController.selection.baseOffset);
|
||||
|
||||
final emojiMatch =
|
||||
RegExp(r':(?:([a-z0-9_+-]+)~)?([a-z0-9_+-]+)$')
|
||||
.firstMatch(searchText);
|
||||
final emojiMatch = RegExp(r':(?:([-\w]+)~)?([-\w]+)$')
|
||||
.firstMatch(searchText);
|
||||
if (emojiMatch != null) {
|
||||
final StickerProvider stickers = Get.find();
|
||||
final emoteSearch = emojiMatch[2]!;
|
||||
return stickers.availableStickers
|
||||
.where((x) =>
|
||||
x.textWarpedPlaceholder.contains(emoteSearch))
|
||||
.where(
|
||||
(x) => x.textWarpedPlaceholder
|
||||
.toUpperCase()
|
||||
.contains(emoteSearch.toUpperCase()),
|
||||
)
|
||||
.map(
|
||||
(x) => ChatMessageSuggestion(
|
||||
type: 'emotes',
|
||||
@ -379,8 +381,8 @@ class _ChatMessageInputState extends State<ChatMessageInput> {
|
||||
.toList();
|
||||
}
|
||||
|
||||
final userMatch = RegExp(r'(?:\s|^)@([a-z0-9_+-]+)$')
|
||||
.firstMatch(searchText);
|
||||
final userMatch =
|
||||
RegExp(r'(?:\s|^)@([-\w]+)$').firstMatch(searchText);
|
||||
if (userMatch != null) {
|
||||
final userSearch = userMatch[1]!.toLowerCase();
|
||||
final AuthProvider auth = Get.find();
|
||||
|
@ -24,9 +24,9 @@ class MarkdownTextContent extends StatelessWidget {
|
||||
});
|
||||
|
||||
Widget _buildContent(BuildContext context) {
|
||||
final emojiMatch = RegExp(r':([a-z0-9_+-]+):').allMatches(content);
|
||||
final isOnlyEmoji =
|
||||
content.replaceAll(RegExp(r':([a-z0-9_+-]+):'), '').trim().isEmpty;
|
||||
final emojiRegex = RegExp(r':([-\w]+):');
|
||||
final emojiMatch = emojiRegex.allMatches(content);
|
||||
final isOnlyEmoji = content.replaceAll(emojiRegex, '').trim().isEmpty;
|
||||
|
||||
return Markdown(
|
||||
shrinkWrap: true,
|
||||
@ -89,7 +89,7 @@ class MarkdownTextContent extends StatelessWidget {
|
||||
switch (segments[0]) {
|
||||
case 'stickers':
|
||||
final StickerProvider sticker = Get.find();
|
||||
url = sticker.aliasImageMapping[segments[1]]!;
|
||||
url = sticker.aliasImageMapping[segments[1].toUpperCase()]!;
|
||||
if (emojiMatch.length <= 1 && isOnlyEmoji) {
|
||||
width = 112;
|
||||
height = 112;
|
||||
@ -161,12 +161,12 @@ class _UserNameCardInlineSyntax extends InlineSyntax {
|
||||
}
|
||||
|
||||
class _CustomEmoteInlineSyntax extends InlineSyntax {
|
||||
_CustomEmoteInlineSyntax() : super(r':([a-z0-9_+-]+):');
|
||||
_CustomEmoteInlineSyntax() : super(r':([-\w]+):');
|
||||
|
||||
@override
|
||||
bool onMatch(markdown.InlineParser parser, Match match) {
|
||||
final StickerProvider sticker = Get.find();
|
||||
final alias = match[1]!;
|
||||
final alias = match[1]!.toUpperCase();
|
||||
if (sticker.aliasImageMapping[alias] == null) {
|
||||
parser.advanceBy(1);
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user