Skip to content

Commit b871df0

Browse files
Merge pull request #6319 from nguyentrannhan/develop
Develop
2 parents cd5f867 + 1e00d43 commit b871df0

File tree

7 files changed

+26
-12
lines changed

7 files changed

+26
-12
lines changed

apps/mobile/src/app/components/ClanSettings/Member/UserItem/UserItem.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Icons } from '@mezon/mobile-components';
22
import { useTheme } from '@mezon/mobile-ui';
3-
import { selectAllRolesClan, selectMemberClanByUserId2, useAppSelector, UsersClanEntity } from '@mezon/store-mobile';
3+
import { selectAllRolesClan, selectMemberClanByUserId2, useAppSelector } from '@mezon/store-mobile';
4+
import { UsersClanEntity } from '@mezon/utils';
45
import { useMemo } from 'react';
56
import { Pressable, Text, View } from 'react-native';
67
import { MezonAvatar } from '../../../../componentUI';

apps/mobile/src/app/screens/home/homedrawer/ChannelApp/index.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,18 @@ const ChannelAppScreen = memo(({ channelId }: { channelId: string }) => {
4141
true;
4242
`;
4343

44+
const injectedCSS = `
45+
(function() {
46+
var style = document.createElement('style');
47+
style.innerHTML = \`
48+
.h-heightTopBar {
49+
display: none !important;
50+
}
51+
\`;
52+
document.head.appendChild(style);
53+
})();
54+
`;
55+
4456
return (
4557
<View style={styles.container}>
4658
{loading && (
@@ -52,7 +64,7 @@ const ChannelAppScreen = memo(({ channelId }: { channelId: string }) => {
5264
height: '100%',
5365
zIndex: 1,
5466
width: '100%',
55-
backgroundColor: themeValue.charcoal,
67+
backgroundColor: themeValue.primary,
5668
flex: 1
5769
}}
5870
>
@@ -72,6 +84,7 @@ const ChannelAppScreen = memo(({ channelId }: { channelId: string }) => {
7284
await sleep(500);
7385
setLoading(false);
7486
}}
87+
injectedJavaScript={injectedCSS}
7588
/>
7689
</View>
7790
);

apps/mobile/src/app/screens/home/homedrawer/Reusables.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useTheme } from '@mezon/mobile-ui';
2-
import { DirectEntity, UsersClanEntity } from '@mezon/store-mobile';
2+
import { DirectEntity } from '@mezon/store-mobile';
3+
import { UsersClanEntity } from '@mezon/utils';
34
import { ChannelType } from 'mezon-js';
45
import React from 'react';
56
import { Image, Text, TouchableOpacity, View } from 'react-native';

apps/mobile/src/app/screens/home/homedrawer/components/MarkdownFormatText/MentionUser.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { ChannelMembersEntity, UsersClanEntity } from '@mezon/store-mobile';
1+
import { ChannelMembersEntity } from '@mezon/store-mobile';
2+
import { UsersClanEntity } from '@mezon/utils';
23
import { ChannelStreamMode } from 'mezon-js/client';
34

45
type IMentionUser = {

apps/mobile/src/app/screens/home/homedrawer/components/RenderTextMarkdown/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ export const RenderTextMarkdownContent = ({
502502
}
503503
const { t, mentions = [], hg = [], ej = [], mk = [], lk = [], vk = [] } = content || {};
504504

505-
const hasMarkdown = mk.length > 0 || isEdited;
505+
const hasMarkdown = mk?.length > 0 || lk?.length > 0 || isEdited;
506506
if (!hasMarkdown) {
507507
const elements = [
508508
...hg.map((item) => ({ ...item, kindOf: ETokenMessage.HASHTAGS })),
@@ -708,7 +708,7 @@ export const RenderTextMarkdownContent = ({
708708
formattedContent += EmojiMarkup({ shortname: contentInElement, emojiid: element.emojiid, isMessageReply: isMessageReply });
709709
}
710710

711-
if (element.kindOf === ETokenMessage.MARKDOWNS) {
711+
if (element.kindOf === ETokenMessage.MARKDOWNS || element.kindOf === ETokenMessage.LINKS) {
712712
if (element.type === EBacktickType.LINK || element.type === EBacktickType.LINKYOUTUBE) {
713713
formattedContent += formatUrls(contentInElement);
714714
} else if (element.type === EBacktickType.BOLD) {

apps/mobile/src/app/screens/serverRoles/SetupMembers/components/AddMemberBs/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { BottomSheetModal } from '@gorhom/bottom-sheet';
22
import { size, useTheme } from '@mezon/mobile-ui';
3-
import { RolesClanEntity, UsersClanEntity } from '@mezon/store-mobile';
3+
import { RolesClanEntity } from '@mezon/store-mobile';
4+
import { UsersClanEntity } from '@mezon/utils';
45
import { RefObject, memo } from 'react';
56
import Backdrop from '../../../../../componentUI/MezonBottomSheet/backdrop';
67
import { AddMemberBsContent } from './AddMemberBsContent';

libs/utils/src/lib/utils/parseHtmlAsFormattedText.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,12 @@ function parseMarkdown(html: string) {
169169
return parsedHtml;
170170
}
171171

172-
const LINK_TEMPLATE = /(?<!<a\s+href="[^"]*">)(https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z]{2,}\b(?:[-a-zA-Z0-9@:%_\+.~#?&//=]*))/gi;
172+
const LINK_TEMPLATE = /((ftp|http|https?):\/\/)?((www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z][-a-zA-Z0-9]{1,62})\b([-a-zA-Z0-9()@:%_+.,~#?&/=]*)/gi;
173173

174174
function parseMarkdownLinks(html: string) {
175175
const parts = html.split(/(`{1,3})/);
176176
let isInCode = false;
177177
let result = '';
178-
179178
for (let i = 0; i < parts.length; i++) {
180179
const part = parts[i];
181180
if (part.match(/^`{1,3}$/)) {
@@ -187,9 +186,7 @@ function parseMarkdownLinks(html: string) {
187186
if (isInCode) {
188187
result += part;
189188
} else {
190-
result += part.replace(LINK_TEMPLATE, (url) => {
191-
return `<a href="${url}" target="_blank">${url}</a>`;
192-
});
189+
result += part.replace(LINK_TEMPLATE, '<a href="$&" target="_blank">$&</a>');
193190
}
194191
}
195192

0 commit comments

Comments
 (0)