mirror of
https://github.com/duckietm/Nitro-Cool-UI.git
synced 2025-06-21 22:36:58 +00:00
Fix sanitize Chatcolor / External Image
This commit is contained in:
parent
47c8455b95
commit
55ed1aba63
@ -1,6 +1,6 @@
|
||||
import { RoomChatSettings, RoomObjectCategory } from '@nitrots/nitro-renderer';
|
||||
import { FC, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { ChatBubbleMessage, GetRoomEngine } from '../../../../api';
|
||||
import { ChatBubbleMessage, sanitizeColor, GetRoomEngine } from '../../../../api';
|
||||
import { useOnClickChat } from '../../../../hooks';
|
||||
|
||||
interface ChatWidgetMessageViewProps
|
||||
@ -16,7 +16,7 @@ export const ChatWidgetMessageView: FC<ChatWidgetMessageViewProps> = props => {
|
||||
const [ isVisible, setIsVisible ] = useState(false);
|
||||
const [ isReady, setIsReady ] = useState<boolean>(false);
|
||||
const { onClickChat = null } = useOnClickChat();
|
||||
const elementRef = useRef<HTMLDivElement>();;
|
||||
const elementRef = useRef<HTMLDivElement>();
|
||||
|
||||
const getBubbleWidth = useMemo(() =>
|
||||
{
|
||||
@ -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: `${chat.chatColours}` }} dangerouslySetInnerHTML={ { __html: `${chat.formattedText}` }} onClick={ e => onClickChat(e) } />
|
||||
<span className="message" style={{ color: sanitizeColor(chat.chatColours) }} dangerouslySetInnerHTML={{ __html: `${chat.formattedText}` }} onClick={ e => onClickChat(e) } />
|
||||
</div>
|
||||
<div className="pointer" />
|
||||
</div>
|
||||
|
@ -52,7 +52,7 @@ const useFurnitureExternalImageWidgetState = () =>
|
||||
|
||||
if(roomObjectPhotoData)
|
||||
{
|
||||
index = datas.findIndex(data => (data.u === roomObjectPhotoData.u))
|
||||
index = datas.findIndex(data => (data.w === roomObjectPhotoData.w))
|
||||
}
|
||||
|
||||
if(index < 0) index = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user