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": {
|
"dependencies": {
|
||||||
"babel-eslint": "^10.1.0",
|
"babel-eslint": "^10.1.0",
|
||||||
"eslint-plugin-react": "^7.21.5",
|
"eslint-plugin-react": "^7.21.5",
|
||||||
"linkify-html": "^3.0.4",
|
"linkify-string": "^3.0.4",
|
||||||
"next": "^10.0.3",
|
"next": "^10.0.3",
|
||||||
"react": "^16.13.0",
|
"react": "^16.13.0",
|
||||||
"react-dom": "^16.13.0",
|
"react-dom": "^16.13.0",
|
||||||
|
@ -2358,10 +2358,10 @@
|
||||||
"node": ">= 0.8.0"
|
"node": ">= 0.8.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/linkify-html": {
|
"node_modules/linkify-string": {
|
||||||
"version": "3.0.4",
|
"version": "3.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/linkify-html/-/linkify-html-3.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/linkify-string/-/linkify-string-3.0.4.tgz",
|
||||||
"integrity": "sha512-pQrMEkEaKfbVj/eCUyi+5lgmRwaCt1MOuzHexyCOZp40iLGEH6j/6kMqg2WLCGKYET70SvFGOoSe5aAnDsoJoQ==",
|
"integrity": "sha512-OnNqqRjlYXaXipIAbBC8sDXsSumI1ftatzFg141Pw9HEXWjTVLFcMZoKbFupshqWRavtNJ6QHLa+u6AlxxgeRw==",
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"linkifyjs": "^3.0.0"
|
"linkifyjs": "^3.0.0"
|
||||||
}
|
}
|
||||||
|
@ -6036,10 +6036,10 @@
|
||||||
"type-check": "~0.4.0"
|
"type-check": "~0.4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"linkify-html": {
|
"linkify-string": {
|
||||||
"version": "3.0.4",
|
"version": "3.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/linkify-html/-/linkify-html-3.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/linkify-string/-/linkify-string-3.0.4.tgz",
|
||||||
"integrity": "sha512-pQrMEkEaKfbVj/eCUyi+5lgmRwaCt1MOuzHexyCOZp40iLGEH6j/6kMqg2WLCGKYET70SvFGOoSe5aAnDsoJoQ==",
|
"integrity": "sha512-OnNqqRjlYXaXipIAbBC8sDXsSumI1ftatzFg141Pw9HEXWjTVLFcMZoKbFupshqWRavtNJ6QHLa+u6AlxxgeRw==",
|
||||||
"requires": {}
|
"requires": {}
|
||||||
},
|
},
|
||||||
"linkifyjs": {
|
"linkifyjs": {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"babel-eslint": "^10.1.0",
|
"babel-eslint": "^10.1.0",
|
||||||
"eslint-plugin-react": "^7.21.5",
|
"eslint-plugin-react": "^7.21.5",
|
||||||
"linkify-html": "^3.0.4",
|
"linkify-string": "^3.0.4",
|
||||||
"next": "^10.0.3",
|
"next": "^10.0.3",
|
||||||
"react": "^16.13.0",
|
"react": "^16.13.0",
|
||||||
"react-dom": "^16.13.0",
|
"react-dom": "^16.13.0",
|
||||||
|
|
|
@ -2,7 +2,7 @@ import React from 'react'
|
||||||
import Head from 'next/head'
|
import Head from 'next/head'
|
||||||
import io from 'socket.io-client'
|
import io from 'socket.io-client'
|
||||||
|
|
||||||
import linkifyHtml from 'linkify-html'
|
import linkifyString from 'linkify-string'
|
||||||
|
|
||||||
import constants from '../constants.json'
|
import constants from '../constants.json'
|
||||||
import LoadingIndicator from '../components/LoadingIndicator'
|
import LoadingIndicator from '../components/LoadingIndicator'
|
||||||
|
@ -534,13 +534,20 @@ export default class Chat extends React.Component {
|
||||||
|
|
||||||
renderMsg(message, key) {
|
renderMsg(message, key) {
|
||||||
const { msg, type } = message
|
const { msg, type } = message
|
||||||
|
console.log(msg)
|
||||||
|
console.log(
|
||||||
|
linkifyString(msg, {
|
||||||
|
defaultProtocol: 'https',
|
||||||
|
target: '_blank',
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
if (type === 'text') {
|
if (type === 'text') {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`${styles.messageEntry}`}
|
className={`${styles.messageEntry}`}
|
||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
__html: linkifyHtml(msg, {
|
__html: linkifyString(msg, {
|
||||||
defaultProtocol: 'https',
|
defaultProtocol: 'https',
|
||||||
target: '_blank',
|
target: '_blank',
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue