Skip to content

Commit

Permalink
fix mardown
Browse files Browse the repository at this point in the history
  • Loading branch information
smritidoneria committed Oct 22, 2024
1 parent 9187d95 commit 743b4cc
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
3 changes: 2 additions & 1 deletion packages/react/src/views/ChatHeader/ChatHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import useSettingsStore from '../../store/settingsStore';
import getChatHeaderStyles from './ChatHeader.styles';
import useSetExclusiveState from '../../hooks/useSetExclusiveState';
import SurfaceMenu from '../SurfaceMenu/SurfaceMenu';
import { Markdown } from '../Markdown';

const ChatHeader = ({
isClosable,
Expand Down Expand Up @@ -385,7 +386,7 @@ const ChatHeader = ({
</Box>
{isThreadOpen && (
<DynamicHeader
title={threadTitle}
title={<Markdown body={threadMessage} isReaction={false} />}
handleClose={closeThread}
iconName="arrow-back"
/>
Expand Down
3 changes: 2 additions & 1 deletion packages/react/src/views/ChatInput/ChatInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { getChatInputStyles } from './ChatInput.styles';
import useShowCommands from '../../hooks/useShowCommands';
import useSearchMentionUser from '../../hooks/useSearchMentionUser';
import formatSelection from '../../lib/formatSelection';
import { Markdown } from '../Markdown';

const ChatInput = ({ scrollToBottom }) => {
const { styleOverrides, classNames } = useComponentOverrides('ChatInput');
Expand Down Expand Up @@ -155,7 +156,7 @@ const ChatInput = ({ scrollToBottom }) => {
messageRef.current.value =
editMessage.attachments[0]?.description || editMessage.msg;
} else if (editMessage.msg) {
messageRef.current.value = editMessage.msg;
messageRef.current.value = <Markdown body={editMessage} />;
} else {
messageRef.current.value = '';
}
Expand Down
4 changes: 3 additions & 1 deletion packages/react/src/views/Message/MessageToolbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { EmojiPicker } from '../EmojiPicker';
import { parseEmoji } from '../../lib/emoji';
import { getMessageToolboxStyles } from './Message.styles';
import SurfaceMenu from '../SurfaceMenu/SurfaceMenu';
import { Markdown } from '../Markdown';
import { useMessageToolboxStyles } from './Message.styles';

export const MessageToolbox = ({
className = '',
Expand Down Expand Up @@ -240,7 +242,7 @@ export const MessageToolbox = ({
padding: '0 0.5rem 0.5rem',
}}
>
{parseEmoji(message.msg)}
<Markdown body={message} isReaction={false} />
</Modal.Content>
<Modal.Footer>
<Button type="secondary" onClick={handleOnClose}>
Expand Down
15 changes: 9 additions & 6 deletions packages/react/src/views/QuoteMessage/QuoteMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
} from '@embeddedchat/ui-elements';
import RCContext from '../../context/RCInstance';
import { useMessageStore } from '../../store';
import getQuoteMessageStyles from './QuoteMessage.styles';
import useQuoteMessageStyles from './QuoteMessage.styles';
import { Markdown } from '../Markdown';

const QuoteMessage = ({ className = '', style = {}, message }) => {
const { RCInstance } = useContext(RCContext);
Expand Down Expand Up @@ -45,11 +46,13 @@ const QuoteMessage = ({ className = '', style = {}, message }) => {
<Box>{format(new Date(message.ts), 'h:mm a')}</Box>
</Box>
<Box css={styles.message}>
{message.msg
? message.msg
: `${message.file?.name} (${
message.file?.size ? (message.file.size / 1024).toFixed(2) : 0
} kB)`}
{message.msg ? (
<Markdown body={message} isReaction={false} />
) : (
`${message.file?.name} (${
message.file?.size ? (message.file.size / 1024).toFixed(2) : 0
} kB)`
)}
</Box>
</Box>
);
Expand Down

0 comments on commit 743b4cc

Please sign in to comment.