pl-fe: avoid dangerouslySetInnerHTML
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
04c10bb680
commit
775f6b1d2b
3 changed files with 9 additions and 8 deletions
|
@ -127,10 +127,9 @@ const Report: React.FC<IReport> = ({ id }) => {
|
||||||
|
|
||||||
<Stack>
|
<Stack>
|
||||||
{!!report.comment && report.comment.length > 0 && (
|
{!!report.comment && report.comment.length > 0 && (
|
||||||
<Text
|
<Text tag='blockquote'>
|
||||||
tag='blockquote'
|
{report.comment}
|
||||||
dangerouslySetInnerHTML={{ __html: report.comment }}
|
</Text>
|
||||||
/>
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!!account && (
|
{!!account && (
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
import { useRelationship } from 'pl-fe/api/hooks/accounts/useRelationship';
|
import { useRelationship } from 'pl-fe/api/hooks/accounts/useRelationship';
|
||||||
import DropdownMenu from 'pl-fe/components/dropdown-menu';
|
import DropdownMenu from 'pl-fe/components/dropdown-menu';
|
||||||
|
import { ParsedContent } from 'pl-fe/components/parsed-content';
|
||||||
import RelativeTimestamp from 'pl-fe/components/relative-timestamp';
|
import RelativeTimestamp from 'pl-fe/components/relative-timestamp';
|
||||||
import Avatar from 'pl-fe/components/ui/avatar';
|
import Avatar from 'pl-fe/components/ui/avatar';
|
||||||
import HStack from 'pl-fe/components/ui/hstack';
|
import HStack from 'pl-fe/components/ui/hstack';
|
||||||
|
@ -124,8 +125,9 @@ const ChatListItem: React.FC<IChatListItemInterface> = ({ chat, onClick }) => {
|
||||||
truncate
|
truncate
|
||||||
className='truncate-child pointer-events-none h-5 w-full'
|
className='truncate-child pointer-events-none h-5 w-full'
|
||||||
data-testid='chat-last-message'
|
data-testid='chat-last-message'
|
||||||
dangerouslySetInnerHTML={{ __html: chat.last_message?.content }}
|
>
|
||||||
/>
|
<ParsedContent html={chat.last_message?.content} emojis={chat.last_message.emojis} />
|
||||||
|
</Text>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -5,11 +5,11 @@ import React, { useMemo, useState } from 'react';
|
||||||
import { defineMessages, useIntl } from 'react-intl';
|
import { defineMessages, useIntl } from 'react-intl';
|
||||||
|
|
||||||
import DropdownMenu from 'pl-fe/components/dropdown-menu';
|
import DropdownMenu from 'pl-fe/components/dropdown-menu';
|
||||||
|
import { ParsedContent } from 'pl-fe/components/parsed-content';
|
||||||
import HStack from 'pl-fe/components/ui/hstack';
|
import HStack from 'pl-fe/components/ui/hstack';
|
||||||
import Icon from 'pl-fe/components/ui/icon';
|
import Icon from 'pl-fe/components/ui/icon';
|
||||||
import Stack from 'pl-fe/components/ui/stack';
|
import Stack from 'pl-fe/components/ui/stack';
|
||||||
import Text from 'pl-fe/components/ui/text';
|
import Text from 'pl-fe/components/ui/text';
|
||||||
import Emojify from 'pl-fe/features/emoji/emojify';
|
|
||||||
import { MediaGallery } from 'pl-fe/features/ui/util/async-components';
|
import { MediaGallery } from 'pl-fe/features/ui/util/async-components';
|
||||||
import { useAppSelector } from 'pl-fe/hooks/useAppSelector';
|
import { useAppSelector } from 'pl-fe/hooks/useAppSelector';
|
||||||
import { ChatKeys, useChatActions } from 'pl-fe/queries/chats';
|
import { ChatKeys, useChatActions } from 'pl-fe/queries/chats';
|
||||||
|
@ -240,7 +240,7 @@ const ChatMessage = (props: IChatMessage) => {
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
>
|
>
|
||||||
<Text size='sm' theme='inherit' className='break-word-nested'>
|
<Text size='sm' theme='inherit' className='break-word-nested'>
|
||||||
<Emojify text={content} emojis={chatMessage.emojis} />
|
<ParsedContent html={content} emojis={chatMessage.emojis} />
|
||||||
</Text>
|
</Text>
|
||||||
</div>
|
</div>
|
||||||
</HStack>
|
</HStack>
|
||||||
|
|
Loading…
Reference in a new issue