other small fix

This commit is contained in:
DuckieTM 2024-03-28 20:37:13 +01:00
parent e4db70d3ba
commit 7cf47fac1c
2 changed files with 2 additions and 11 deletions

View File

@ -116,15 +116,6 @@ allowedColours.set('saddlebrown', 'saddlebrown');
allowedColours.set('sienna', 'sienna');
allowedColours.set('brown', 'brown');
export const sanitizeColor = (color: string | null | undefined): string | null => {
if (!color) {
return null;
}
const sanitizedColor = allowedColours.get(color.toLowerCase());
return sanitizedColor || null;
};
const encodeHTML = (str: string) =>
{
return str.replace(/([\u00A0-\u9999<>&])(.|$)/g, (full, char, next) =>

View File

@ -1,6 +1,6 @@
import { RoomChatSettings, RoomObjectCategory } from '@nitrots/nitro-renderer';
import { FC, useEffect, useMemo, useRef, useState } from 'react';
import { ChatBubbleMessage, sanitizeColor, GetRoomEngine } from '../../../../api';
import { ChatBubbleMessage, GetRoomEngine } from '../../../../api';
import { useOnClickChat } from '../../../../hooks';
interface ChatWidgetMessageViewProps
@ -89,7 +89,7 @@ export const ChatWidgetMessageView: FC<ChatWidgetMessageViewProps> = props => {
</div>
<div className="chat-content">
<b className="username mr-1" dangerouslySetInnerHTML={ { __html: `${ chat.username }: ` } } />
<span className="message" style={{ color: sanitizeColor(chat.chatColours) }} dangerouslySetInnerHTML={{ __html: `${chat.formattedText}` }} onClick={ e => onClickChat(e) } />
<span className="message" style={{ color: chat.chatColours }} dangerouslySetInnerHTML={{ __html: `${chat.formattedText}` }} onClick={e => onClickChat(e)} />
</div>
<div className="pointer" />
</div>