diff --git a/package-lock.json b/package-lock.json index 39fd078..bc48618 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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": { diff --git a/package.json b/package.json index ddd12b0..7e94f62 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/pages/chat.js b/src/pages/chat.js index 2502b87..5102d8f 100644 --- a/src/pages/chat.js +++ b/src/pages/chat.js @@ -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 (