mirror of
https://gitlab.com/MrFry/qmining-page
synced 2025-04-01 20:23:44 +02:00
Chat html fix
This commit is contained in:
parent
98761a8e7d
commit
57a7ab9fb7
3 changed files with 17 additions and 10 deletions
14
package-lock.json
generated
14
package-lock.json
generated
|
@ -11,7 +11,7 @@
|
|||
"dependencies": {
|
||||
"babel-eslint": "^10.1.0",
|
||||
"eslint-plugin-react": "^7.21.5",
|
||||
"linkify-html": "^3.0.4",
|
||||
"linkify-string": "^3.0.4",
|
||||
"next": "^10.0.3",
|
||||
"react": "^16.13.0",
|
||||
"react-dom": "^16.13.0",
|
||||
|
@ -2358,10 +2358,10 @@
|
|||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/linkify-html": {
|
||||
"node_modules/linkify-string": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/linkify-html/-/linkify-html-3.0.4.tgz",
|
||||
"integrity": "sha512-pQrMEkEaKfbVj/eCUyi+5lgmRwaCt1MOuzHexyCOZp40iLGEH6j/6kMqg2WLCGKYET70SvFGOoSe5aAnDsoJoQ==",
|
||||
"resolved": "https://registry.npmjs.org/linkify-string/-/linkify-string-3.0.4.tgz",
|
||||
"integrity": "sha512-OnNqqRjlYXaXipIAbBC8sDXsSumI1ftatzFg141Pw9HEXWjTVLFcMZoKbFupshqWRavtNJ6QHLa+u6AlxxgeRw==",
|
||||
"peerDependencies": {
|
||||
"linkifyjs": "^3.0.0"
|
||||
}
|
||||
|
@ -6036,10 +6036,10 @@
|
|||
"type-check": "~0.4.0"
|
||||
}
|
||||
},
|
||||
"linkify-html": {
|
||||
"linkify-string": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/linkify-html/-/linkify-html-3.0.4.tgz",
|
||||
"integrity": "sha512-pQrMEkEaKfbVj/eCUyi+5lgmRwaCt1MOuzHexyCOZp40iLGEH6j/6kMqg2WLCGKYET70SvFGOoSe5aAnDsoJoQ==",
|
||||
"resolved": "https://registry.npmjs.org/linkify-string/-/linkify-string-3.0.4.tgz",
|
||||
"integrity": "sha512-OnNqqRjlYXaXipIAbBC8sDXsSumI1ftatzFg141Pw9HEXWjTVLFcMZoKbFupshqWRavtNJ6QHLa+u6AlxxgeRw==",
|
||||
"requires": {}
|
||||
},
|
||||
"linkifyjs": {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
"dependencies": {
|
||||
"babel-eslint": "^10.1.0",
|
||||
"eslint-plugin-react": "^7.21.5",
|
||||
"linkify-html": "^3.0.4",
|
||||
"linkify-string": "^3.0.4",
|
||||
"next": "^10.0.3",
|
||||
"react": "^16.13.0",
|
||||
"react-dom": "^16.13.0",
|
||||
|
|
|
@ -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',
|
||||
}),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue