Chat html fix

This commit is contained in:
mrfry 2022-02-18 13:13:30 +01:00
parent 98761a8e7d
commit 57a7ab9fb7
3 changed files with 17 additions and 10 deletions

View file

@ -2,7 +2,7 @@ import React from 'react'
import Head from 'next/head'
import io from 'socket.io-client'
import linkifyHtml from 'linkify-html'
import linkifyString from 'linkify-string'
import constants from '../constants.json'
import LoadingIndicator from '../components/LoadingIndicator'
@ -534,13 +534,20 @@ export default class Chat extends React.Component {
renderMsg(message, key) {
const { msg, type } = message
console.log(msg)
console.log(
linkifyString(msg, {
defaultProtocol: 'https',
target: '_blank',
})
)
if (type === 'text') {
return (
<div
className={`${styles.messageEntry}`}
dangerouslySetInnerHTML={{
__html: linkifyHtml(msg, {
__html: linkifyString(msg, {
defaultProtocol: 'https',
target: '_blank',
}),