Use same message highlighting on system messages
This commit is contained in:
parent
c0a2729226
commit
57d8bdbdbe
@ -30,9 +30,11 @@
|
||||
}
|
||||
|
||||
mark {
|
||||
padding-left: 0.35em;
|
||||
padding-right: 0.35em;
|
||||
background-color: var(--theme-color-palette-12);
|
||||
padding-left: 0.3em;
|
||||
padding-right: 0.3em;
|
||||
color: var(--theme-color-palette-4);
|
||||
border-radius: var(--theme-rounded-corners);
|
||||
background-color: var(--color-owncast-palette-7);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
/* eslint-disable react/no-danger */
|
||||
import { Highlight } from 'react-highlighter-ts';
|
||||
import { FC } from 'react';
|
||||
import cn from 'classnames';
|
||||
import { Interweave } from 'interweave';
|
||||
import { UrlMatcher } from 'interweave-autolink';
|
||||
import { ChatMessage } from '../../../interfaces/chat-message.model';
|
||||
import styles from './ChatSystemMessage.module.scss';
|
||||
import { ChatMessageHighlightMatcher } from '../ChatUserMessage/customMatcher';
|
||||
|
||||
export type ChatSystemMessageProps = {
|
||||
message: ChatMessage;
|
||||
@ -21,8 +22,13 @@ export const ChatSystemMessage: FC<ChatSystemMessageProps> = ({
|
||||
<div className={styles.user}>
|
||||
<span className={styles.userName}>{displayName}</span>
|
||||
</div>
|
||||
<Highlight search={highlightString}>
|
||||
<div className={styles.message} dangerouslySetInnerHTML={{ __html: body }} />
|
||||
</Highlight>
|
||||
<Interweave
|
||||
className={styles.message}
|
||||
content={body}
|
||||
matchers={[
|
||||
new UrlMatcher('url', { validateTLD: false }),
|
||||
new ChatMessageHighlightMatcher('highlight', { highlightString }),
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable react/no-danger */
|
||||
import { FC, ReactNode } from 'react';
|
||||
import cn from 'classnames';
|
||||
import { Tooltip } from 'antd';
|
||||
|
238
web/package-lock.json
generated
238
web/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -42,7 +42,6 @@
|
||||
"react-chartkick": "^0.5.3",
|
||||
"react-crossfade-img": "1.0.0",
|
||||
"react-dom": "18.2.0",
|
||||
"react-highlighter-ts": "18.0.1",
|
||||
"react-hotkeys-hook": "4.3.4",
|
||||
"react-linkify": "1.0.0-alpha",
|
||||
"react-markdown": "8.0.5",
|
||||
|
Loading…
x
Reference in New Issue
Block a user