From d0399cd86265656da5fbbb3e2b8c9ed9d11da031 Mon Sep 17 00:00:00 2001 From: Kishan0109 Date: Sun, 14 May 2023 10:15:38 +0530 Subject: [PATCH 1/7] fix: Omnichannel skeleton loading padding while creating new channel --- .../directory/contacts/contextualBar/ContactNewEdit.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/meteor/client/views/omnichannel/directory/contacts/contextualBar/ContactNewEdit.tsx b/apps/meteor/client/views/omnichannel/directory/contacts/contextualBar/ContactNewEdit.tsx index dc4d7d839e63..9eb9799c9d44 100644 --- a/apps/meteor/client/views/omnichannel/directory/contacts/contextualBar/ContactNewEdit.tsx +++ b/apps/meteor/client/views/omnichannel/directory/contacts/contextualBar/ContactNewEdit.tsx @@ -1,5 +1,5 @@ import type { ILivechatVisitor, Serialized } from '@rocket.chat/core-typings'; -import { Field, TextInput, ButtonGroup, Button } from '@rocket.chat/fuselage'; +import { Field, TextInput, ButtonGroup, Button, Box } from '@rocket.chat/fuselage'; import { useToastMessageDispatch, useEndpoint, useTranslation } from '@rocket.chat/ui-contexts'; import type { ReactElement } from 'react'; import React, { useState, useEffect } from 'react'; @@ -166,7 +166,11 @@ const ContactNewEdit = ({ id, data, close }: ContactNewEditProps): ReactElement }; if (isLoadingCustomFields) { - return ; + return ( + + + + ); } return ( From 59e0e51380ac9735e2e914493c418d5794807bb1 Mon Sep 17 00:00:00 2001 From: Kishan0109 Date: Sun, 14 May 2023 10:25:00 +0530 Subject: [PATCH 2/7] revert changes to push on dev --- .../directory/contacts/contextualBar/ContactNewEdit.tsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/apps/meteor/client/views/omnichannel/directory/contacts/contextualBar/ContactNewEdit.tsx b/apps/meteor/client/views/omnichannel/directory/contacts/contextualBar/ContactNewEdit.tsx index 9eb9799c9d44..dc4d7d839e63 100644 --- a/apps/meteor/client/views/omnichannel/directory/contacts/contextualBar/ContactNewEdit.tsx +++ b/apps/meteor/client/views/omnichannel/directory/contacts/contextualBar/ContactNewEdit.tsx @@ -1,5 +1,5 @@ import type { ILivechatVisitor, Serialized } from '@rocket.chat/core-typings'; -import { Field, TextInput, ButtonGroup, Button, Box } from '@rocket.chat/fuselage'; +import { Field, TextInput, ButtonGroup, Button } from '@rocket.chat/fuselage'; import { useToastMessageDispatch, useEndpoint, useTranslation } from '@rocket.chat/ui-contexts'; import type { ReactElement } from 'react'; import React, { useState, useEffect } from 'react'; @@ -166,11 +166,7 @@ const ContactNewEdit = ({ id, data, close }: ContactNewEditProps): ReactElement }; if (isLoadingCustomFields) { - return ( - - - - ); + return ; } return ( From 7b353167a3dc7976e6d867d338d8033293dd8899 Mon Sep 17 00:00:00 2001 From: Kishn0109 Date: Sat, 8 Jun 2024 21:20:01 +0530 Subject: [PATCH 3/7] fix: correct token type to 'strong' for asterisk-wrapped text --- apps/meteor/client/components/MarkdownText.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/meteor/client/components/MarkdownText.tsx b/apps/meteor/client/components/MarkdownText.tsx index 51e499f91d8f..7dc13627d120 100644 --- a/apps/meteor/client/components/MarkdownText.tsx +++ b/apps/meteor/client/components/MarkdownText.tsx @@ -16,16 +16,18 @@ type MarkdownTextParams = { withTruncatedText: boolean; } & ComponentProps; +const walkTokens = (token: marked.Token) => { + const strongPattern = /^\*.*\*$|^\*.*|.*\*$/; + if (strongPattern.test(token.raw)) { + token.type = 'strong'; + } +}; + +marked.use({ walkTokens }); const documentRenderer = new marked.Renderer(); const inlineRenderer = new marked.Renderer(); const inlineWithoutBreaks = new marked.Renderer(); -marked.Lexer.rules.gfm = { - ...marked.Lexer.rules.gfm, - strong: /^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/, - em: /^__(?=\S)([\s\S]*?\S)__(?!_)|^_(?=\S)([\s\S]*?\S)_(?!_)/, -}; - const linkMarked = (href: string | null, _title: string | null, text: string): string => `${text} `; const paragraphMarked = (text: string): string => text; @@ -110,7 +112,7 @@ const MarkdownText: FC> = ({ const markedHtml = /inline/.test(variant) ? marked.parseInline(new Option(content).innerHTML, markedOptions) : marked.parse(new Option(content).innerHTML, markedOptions); - + console.log(marked.parse(new Option(content).innerHTML), new Option(content).innerHTML, 'content'); if (parseEmoji) { // We are using the old emoji parser here. This could come // with additional processing use, but is the workaround available right now. From e5866bbc8e2994a1f1a3df0fa26da103d4e3b2e9 Mon Sep 17 00:00:00 2001 From: Kishn0109 Date: Sat, 8 Jun 2024 21:34:27 +0530 Subject: [PATCH 4/7] chore: remove console.log --- apps/meteor/client/components/MarkdownText.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/meteor/client/components/MarkdownText.tsx b/apps/meteor/client/components/MarkdownText.tsx index 7dc13627d120..410fe6d7dbd5 100644 --- a/apps/meteor/client/components/MarkdownText.tsx +++ b/apps/meteor/client/components/MarkdownText.tsx @@ -112,7 +112,6 @@ const MarkdownText: FC> = ({ const markedHtml = /inline/.test(variant) ? marked.parseInline(new Option(content).innerHTML, markedOptions) : marked.parse(new Option(content).innerHTML, markedOptions); - console.log(marked.parse(new Option(content).innerHTML), new Option(content).innerHTML, 'content'); if (parseEmoji) { // We are using the old emoji parser here. This could come // with additional processing use, but is the workaround available right now. From d566f48fdfcb6f86bb337a4ea658d0d645464b36 Mon Sep 17 00:00:00 2001 From: Kishn0109 Date: Sat, 8 Jun 2024 21:55:24 +0530 Subject: [PATCH 5/7] chore: Add changeset --- .changeset/kind-drinks-joke.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/kind-drinks-joke.md diff --git a/.changeset/kind-drinks-joke.md b/.changeset/kind-drinks-joke.md new file mode 100644 index 000000000000..afe54406f4e7 --- /dev/null +++ b/.changeset/kind-drinks-joke.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/meteor': major +--- + +Fixed issue with asterisk-wrapped text not becoming bold when user enters profile custom status. From ccd0a532dc9e67464bbaf3fc53c9bdfb80dc4aa6 Mon Sep 17 00:00:00 2001 From: Kishn0109 Date: Tue, 11 Jun 2024 23:07:10 +0530 Subject: [PATCH 6/7] fix: italic format in markdownText --- apps/meteor/client/components/MarkdownText.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/meteor/client/components/MarkdownText.tsx b/apps/meteor/client/components/MarkdownText.tsx index 410fe6d7dbd5..e88fc3bea61b 100644 --- a/apps/meteor/client/components/MarkdownText.tsx +++ b/apps/meteor/client/components/MarkdownText.tsx @@ -17,9 +17,12 @@ type MarkdownTextParams = { } & ComponentProps; const walkTokens = (token: marked.Token) => { - const strongPattern = /^\*.*\*$|^\*.*|.*\*$/; - if (strongPattern.test(token.raw)) { + const boldPattern = /^\*.*\*$|^\*.*|.*\*$/; + const italicPattern = /^__(?=\S)([\s\S]*?\S)__(?!_)|^_(?=\S)([\s\S]*?\S)_(?!_)/; + if (boldPattern.test(token.raw)) { token.type = 'strong'; + } else if (italicPattern.test(token.raw)) { + token.type = 'em'; } }; From 04653c5c3e34063d609a090d11a0eb3331872fe9 Mon Sep 17 00:00:00 2001 From: csuadev <72958726+csuadev@users.noreply.github.com> Date: Wed, 12 Jun 2024 15:28:10 +0200 Subject: [PATCH 7/7] Update .changeset/kind-drinks-joke.md Co-authored-by: Marcos Spessatto Defendi --- .changeset/kind-drinks-joke.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/kind-drinks-joke.md b/.changeset/kind-drinks-joke.md index afe54406f4e7..b235f5556805 100644 --- a/.changeset/kind-drinks-joke.md +++ b/.changeset/kind-drinks-joke.md @@ -1,5 +1,5 @@ --- -'@rocket.chat/meteor': major +'@rocket.chat/meteor': patch --- Fixed issue with asterisk-wrapped text not becoming bold when user enters profile custom status.